QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#262709#1971. HezardastandXqwq#AC ✓213ms11412kbC++234.2kb2023-11-23 22:01:242023-11-23 22:01:26

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4272kb

input:

8 7
K-PAX SIRIUS REGULUS ARCTURUS BELLATRIX ANDROMEDA CYGNUS SCORPIUS
8 1 2 3 4 5 6 8 7
6 2 3 4 7 8 6
5 1 2 3 5 8
3 5 6 7
2 2 8
0
1 1

output:

8001 1 *
6002 2 A* *S
5003 3 R* S* *X
3003 3 AN* B* C*
2001 1 S*
0 0
1001 1 K*

result:

ok correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 4176kb

input:

1 2
A
0
1 1

output:

0 0
1001 1 *

result:

ok correct

Test #3:

score: 0
Accepted
time: 1ms
memory: 4220kb

input:

2 4
A B
1 2
0
1 1
2 1 2

output:

1001 1 B*
0 0
1001 1 A*
2001 1 *

result:

ok correct

Test #4:

score: 0
Accepted
time: 1ms
memory: 4172kb

input:

1 2
AB
0
1 1

output:

0 0
1001 1 *

result:

ok correct

Test #5:

score: 0
Accepted
time: 0ms
memory: 4104kb

input:

2 4
A AB
2 1 2
0
1 1
1 2

output:

2001 1 *
0 0
1001 1 A
1001 1 AB*

result:

ok correct

Test #6:

score: 0
Accepted
time: 0ms
memory: 4244kb

input:

2 4
A BA
1 2
2 1 2
0
1 1

output:

1001 1 B*
2001 1 *
0 0
1001 1 A*

result:

ok correct

Test #7:

score: 0
Accepted
time: 1ms
memory: 4364kb

input:

3 8
A B C
2 2 3
2 1 2
1 3
0
1 2
3 3 2 1
2 3 1
1 1

output:

2002 2 B* C*
2002 2 A* B*
1001 1 C*
0 0
1001 1 B*
3001 1 *
2002 2 A* C*
1001 1 A*

result:

ok correct

Test #8:

score: 0
Accepted
time: 1ms
memory: 4176kb

input:

1 2
ABC
1 1
0

output:

1001 1 *
0 0

result:

ok correct

Test #9:

score: 0
Accepted
time: 1ms
memory: 4144kb

input:

2 4
AB ABC
0
2 2 1
1 1
1 2

output:

0 0
2001 1 *
1001 1 AB
1001 1 ABC*

result:

ok correct

Test #10:

score: 0
Accepted
time: 1ms
memory: 4244kb

input:

2 4
A ABC
1 2
0
1 1
2 1 2

output:

1001 1 AB*
0 0
1001 1 A
2001 1 *

result:

ok correct

Test #11:

score: 0
Accepted
time: 1ms
memory: 4152kb

input:

3 8
A AB ABC
2 3 1
0
2 2 1
1 1
3 1 3 2
2 2 3
1 3
1 2

output:

2002 2 A ABC*
0 0
2002 2 A AB
1001 1 A
3001 1 *
2001 1 AB*
1001 1 ABC*
1001 1 AB

result:

ok correct

Test #12:

score: 0
Accepted
time: 159ms
memory: 9556kb

input:

803 100
CQ3WDIY3SD BI5AFJ9MMR B6O7ET7572 CQGMC7R4WD BAHSOB3SR2 WC77BFVCP2 C8W28TZ-TD WAI462U52D CQKN3HAFYD CPXLSU-POR BY5CJJMUH2 B3O1M0QL62 CMDE4OCUM2 B5NHGKPDOR CM1401G-RD WAOI3Z-7XD B4YJB4ID-R CC5POFTRVR B7K5BUCVTD B3BUZ5EAZD CTTY5VAXJ2 BX6YJL2FNR CSH608L01D W2K4RQBSXR B1D8T4AH8D B58M3B-UG2 B28Z04...

output:

130128 128 B--* B1O* B1QH* B1T* B1W* B2A* B2Z* B3O* B3RX* B3S* B4Q* B4S* B5Z* B67* B6J* B8U* B9-* B91* BA2-* BB5* BCY* BD0* BDX* BEP5* BFH* BFT* BHM* BHW* BJO* BKD* BNB8* BOAQ* BOD* BOJ* BOO* BPH* BPS* BQP* BRU* BSO* BSV* BTO* BV0* BVF* BWU* BX6* BY0* C0H* C0I* C1G* C20* C2P* C2QG* C8F* C8R* CB3* CC...

result:

ok correct

Test #13:

score: 0
Accepted
time: 45ms
memory: 5596kb

input:

206 100
W7NIO4VAN7 3GK-DMGK8U 3KLSUXD4JX WU4CVHWHPX 3OG75G-TRP 3-N7FXW3V7 16B9S6HUT7 TARLAQMG1H TZ3CGBEWQH R9O9SWJ8E7 35RV2QSAR7 RYWFN4WTL0 TD-O-J233U WRHAHADLEU WMSR2GY5S7 WR9HRRXZSP TIRAKFTXPX R753K0P6EP XNLUEDLAEX 188LPIDPKX 37SAM404FU T3ZVREV2WU WN99DYF54P X0KNAKPWOP 35GFCE4IPU WI5W9Z6F3U 16-ADB...

output:

196115 115 13* 14* 16* 17* 1D* 1FC* 1G* 1H* 1I* 1J* 1L* 1R* 1T* 1U* 1X* 1Z* 35* 37* 39* 3C* 3D* 3E* 3G* 3K* 3M* 3NV* 3NY* 3P* 3R* 3S* 3T* 3W* 3Z* R2* R3* R6* R7* R9* RA* RF* RG* RH* RN* RT* RX* RY* RZ* T0* T2* T4* T8* TA* TC* TE* TL* TN* TO* TP* TQ* TV* TW* TX* TY* TZ* W0* W1* W6* W7* WC* WK* WL* WM...

result:

ok correct

Test #14:

score: 0
Accepted
time: 170ms
memory: 10072kb

input:

906 100
AM46Z0MXLJ AZKKLNUMWP T51TW0AZLC ZG9NZVLRSP L-2JMTU-AC FX4DCXQIXJ V2DJKT2GM0 FBYEQNDPSJ F494LP4GS0 V9PFHS3L6J TAUBZFR3BJ TEBM88HU-P T85J5K9EYM AU3G56H2KC ZJN-7TOAPM AP4G4LDHZ0 TDX2Z-UJ20 FE8NYQBYF0 LQKBV2582P FMZRJV54FP ZW9AXZ30OC TK0T82GX6C LVVVD8OIHM ZJTE8YHY1P ZO8-FT36IC ZSLJ1CG6HM TWPWHP...

output:

453389 389 A-9* A-M* A0F* A0Q* A0T* A1B* A1L* A28* A2Y* A36* A3E* A3S* A4K* A5RA* A6E* A7E* A7QY* A92* A93* A95* A9B* A9P* AAD* AB0* AB4* AB6* ABDA* AC0* ADH* ADM* ADY* AED* AEL* AF1* AF8* AFB* AG9* AH4* AH9* AHF* AHP* AHY* AIC* AIJ* AK2* AKA* AM4* AMU* AMV* AN4* AN8* AO* APE* AQ6* ASD* ASG* AU3* AV...

result:

ok correct

Test #15:

score: 0
Accepted
time: 104ms
memory: 7564kb

input:

514 100
HRQQFROGZ6 XKGQ3O3AW6 5CWKWXOKU5 HFJ39F7P0D L3UDP7HL8D K9O976VAHD 0EJ2LC5YL5 UI8JWJS6Z5 LVA-G-ZYR6 USEDOZ12O5 J1DRPLR905 H-JCM3N04D LRFI5-4X5D DQ16KF0PX5 U7GBSAO5L5 0Q78OHWFI5 NETHRINMQ6 JJN1640DA5 4NNXPLA5T5 N85CWUTXK5 K0R7C7LIR6 POLO4L9T7D U8UKB7ZFWD KJ5P0OZEO5 4-23X9ZP55 JC8GJ5JWKD LGZUPC...

output:

354243 243 --* -1* -5* -8* -C* -D* -N* -Y* 031* 08* 09I* 0B* 0E* 0G* 0M* 0N* 0P* 0Q* 0U* 4-* 42* 44* 47* 48* 49* 4A4* 4D* 4F* 4H* 4J9* 4K* 4NN* 4Q* 4S6* 4SB* 4UO* 4V2* 4VC* 5-* 50J* 54* 556* 57* 58* 59V* 5A* 5B* 5C* 5GE* 5H* 5I* 5J* 5K* 5L7* 5N* 5O* 5P* 5RC* 5U* 5X* 5Y* D-* D2* D5Q* D8* DB-* DBJ* DH...

result:

ok correct

Test #16:

score: 0
Accepted
time: 112ms
memory: 7656kb

input:

514 100
L96USRZM0R LZG4B1YBFV LIWW6DYKKJ JKCBL0O-F0 LPSF-KUIFL PZT7W87ODV L3NE13IXZW L-KUJP48RV JVM1BWDL80 JR79AO561V LVPN1QA5XY JVZWNDU8S0 PLMTYPH-W2 J4ZRSDNOEZ LEBE-EEKY2 J9B1G3F2U4 PF1IYLK8TR JE11IW9R2Q J38ZIHGUYZ PJ60-64VLW LNP0RFLERZ L9LHGCCJD0 L-YOS22I-F P3P2LJL2GR LGG4S7E9M2 JFM6IKMRBL JSRAPO...

output:

248215 215 J-1* J-7* J-K* J09* J0D* J10* J12* J1F* J2G* J39* J52* J5B* J70* J71* J73* J9L* JA3* JB0* JBE* JBF* JC* JDB* JDH* JE1* JEJ* JF0* JFW* JH2* JHI* JIE* JIM* JIV* JJT* JK5* JK9* JL3* JMD* JMM* JMQ* JMY* JNY* JOA* JOT* JP1* JPL* JPP* JQ-* JQL* JQT* JR7* JRD* JRQ9* JRR* JS7* JSG* JSO* JSR* JUA*...

result:

ok correct

Test #17:

score: 0
Accepted
time: 114ms
memory: 8860kb

input:

614 100
WCC4V-YSP5 X-0G-V82N8 KONWGWS5QT OONP33YVOV KOXU-81YIQ URZ9JOEMHY QLJO2235LI -DPZVO00T5 G800H9UIEH -GJPY0XMGT KZVFW4D3OQ 6P3YNNEPLQ 65LAON651X 0H8GORN6-X U5J-YMVT2V XN7CWFHB9T Y5AD68Q4H0 WCIFZRUV-H G4N9HHZ8-5 Y2F-EDA1J1 0MUVY2XLHA 8QW1KN9BL0 -FCCKWVN3T GA548DYM7Y KM72O6FUDG UA0YN1P8PG Q4RBHD...

output:

183159 159 -11* -6O* -77* -8Q* -CC* -DD* -F* -GBZ* -H* -IR* -L* -RX* -W* -X* 02* 05T* 07* 09* 0D* 0O* 0QL* 0SU* 0U0* 0Y* 0Z* 6-* 62* 639* 64K* 66* 68V* 6A* 6G* 6I4* 6S-* 6XM* 80* 82* 83* 88* 8A* 8D* 8F3* 8FZ* 8G* 8YC* B2I* B4* B63* B8* BE* BF* BO* BP* BT* BU* D-J* D3* DD* DF9* DHF* DI* DS* DWO* DYB*...

result:

ok correct

Test #18:

score: 0
Accepted
time: 183ms
memory: 10316kb

input:

914 100
V5W5MV48VU JVVC804AZ7 YA19I7GKJ4 MFD643KHBF YK3OG4LDZD K2O5DKELDJ RQOI4GLHLF VBFLM3KBOT 7YWHM7AR-8 MRZJY2UGCX 1QJG-FVCKP 74YJ1B58ED CGKOVYQVCP HSIC91T98V JA4ELCIGNU VMYN4KIZ6P K2CQLJJ63C PMY12Y3PC5 PJ5MMWS5OT JGWS986DEP H4WX27KQE7 MAB--0UIM4 RC75BV8PVT UBV6MH5UOC HQAQM9UTRF R6LALTM19D CVLI-Z...

output:

521375 375 10* 12-* 12P* 12R* 14* 15* 18T* 18U* 1E* 1H* 1J4* 1J8* 1K* 1L* 1Q* 1R* 1S* 1UM* 1V* 1X1* 1XR* 1Y* 72* 74E* 750* 75E* 773* 78* 79* 7C* 7E0* 7EM* 7G* 7I4* 7II* 7IU* 7J2* 7M* 7N* 7OU* 7R2* 7RU* 7X7* 7XK* 7Y* 7Z2* C0* C19* C1Q* C3* C6* C7T* C8X* CAI* CAR* CB* CD* CE* CIM* CJ* CK6* CO* CPB* CP...

result:

ok correct

Test #19:

score: 0
Accepted
time: 164ms
memory: 10480kb

input:

923 100
02DU15IS6A U3Z4MW-QQE 82NKKTU-ZS 4SO95XTIC9 OQY-ZQRUGI H3BO76UNN3 857LO29G7J 9CB2LXC-W7 TTVGRPOK87 YMTTM-3RHT H59I7RBBDW 2YUSGOZ5MN 5E43579XBT TRSYI32YQ8 H2X7XL8DLU 25P89DXTNJ DKDOB6UWZ9 D9Y2HW92DO 2J6HDOG8YA ULLOA-QOME WG4OCGW5WO RR2-F6TM73 0QC0XE2IQW 8IAFPQSKNW H61OQEATD9 TQCFQK0WIU D1N0UR...

output:

439343 343 01R* 01Z* 02* 04K* 04M* 05E* 06B3* 091* 09P* 0B* 0C* 0D* 0F* 0G1X* 0G7* 0I* 0KK* 0M7* 0OT* 0S-* 0TF* 0UN* 0V-* 0V1* 0X* 25M* 25S* 26I* 26P* 26Q* 28G* 29* 2A* 2B5* 2D* 2E* 2H20* 2HI* 2II* 2J* 2L* 2M* 2O* 2W* 4-0* 40* 428* 44* 46* 4BY* 4BZ* 4EK* 4I7* 4II* 4JO* 4K* 4P* 4V* 4Y* 52* 54Y* 551* ...

result:

ok correct

Test #20:

score: 0
Accepted
time: 196ms
memory: 11124kb

input:

990 100
OR4Q33JL64 U93T4VNWIN IMOF-B0WV3 USX1SKBO7Q VIW0ZL0TP9 29GG57V1XU G3I2HH6X7V S4QFQAPINB FGPOZDORVZ 5SBEMSOWJH Y5BRZPO9NU VGTO6I6HRC E8VWBO3HW8 YQUPH-WKB3 BC0QV9QENZ U1L49WWRUI 8JVW5S1XS2 F8355QXKF6 44UJRRIA5B 1RZSC334-H NFH0L3IO8F 5EUS-24K42 UD12L7-T-0 5Y6BEPQBU6 G06SC7KNE3 FXNDDBLBQS 4XMKES...

output:

260232 232 -04* -2* -C* -K* -P* -TC* -XM* 1B* 1D5* 1DX* 1K* 1N* 1PC* 1U* 1W* 2-O* 22* 2F7* 2KC* 2N* 2R31* 2S* 2X* 4-F* 4G* 4H3* 4I* 4M* 4S3* 4V0* 4XJ* 4XW* 4YF* 4Z* 54* 57* 5E8* 5EM* 5J3* 5WE* 5Y6* 5Z* 64-* 6C* 6L* 6O* 6P* 6QQ* 6S* 6U* 6WX* 7-Y* 72* 73B* 73D* 7AS* 7BL* 7I3* 7O1* 7OT* 7P* 7VM* 7ZV* 8...

result:

ok correct

Test #21:

score: 0
Accepted
time: 208ms
memory: 11208kb

input:

997 100
3G50RU18DK ZENZYU0RDG P76NNCV6UB JR3PFF3FQU RQN5X4N1KL 8IT3OCB0LI 9MF8L74N5J 9B0672VN1E 4C294ZF3TC J3QD3B5ZBR RO4J6KYPJS UEVEOC0GM3 Z0SVUOMT91 F9V14Q76XY EK4Q04F0PQ 6KFYOYLRSB G2XLU7ZHTA 1W48-OBBHF 20ZF5JERBU 8ZIVSHBH5A QGZRK0TFXJ 3RO-RU5B9N PQB9YMX-1Z YUMGXIGKLS YMMCOGEZF1 BCLZ4M02M3 GHZ60J...

output:

541414 414 -3* -5* -AWW* -F* -J* -K* -M* -OU* -W* -Z* 1-* 10* 13* 15* 16* 19* 1A0* 1J* 1MK* 1N* 1PIB* 1RA* 1S* 1T4* 1XC* 2-* 20H* 2D1* 2G* 2Q* 2S* 2U* 2X* 2YI* 31N* 37* 3C* 3G* 3M* 3N* 3P2* 3Q* 3S* 3TQ* 3U* 3V* 3W* 3X8* 3Z* 404* 40H* 41* 43V* 467* 4D* 4F* 4G* 4J* 4K* 4N* 4O* 4R4* 4U* 607* 61* 63* 65...

result:

ok correct

Test #22:

score: 0
Accepted
time: 1ms
memory: 4148kb

input:

2 4
BA CBA
0
1 1
2 1 2
1 2

output:

0 0
1001 1 B*
2001 1 *
1001 1 C*

result:

ok correct

Test #23:

score: 0
Accepted
time: 212ms
memory: 11212kb

input:

998 100
EO0ED0NUTL 1JKH0B5ITH OUJ5KE99ZW 19ZK0WJPO0 H4BFNDS8US 26K4M4MZWP WUV-ZZIEFU WIH2IBRFZL UBA3W8G55S 64-E1A9-JL BTXWZSND80 I-NFNQ4VS6 MG1P3-81S3 MAU4BOHP9H OQ9A8-707P J5Y0R0SEUP -00PJA9ZIL VWLP4WER2H QDXCSZ0T3C 4SOM6N54TN X-EK6X3DW8 05NPZAG0VY JNRF4DPD73 IIRRNXEQBU 2NGLKZ4U33 T63IYYFQ31 FKT6E3...

output:

529413 413 --9* -02* -1O* -BO* -J* -N* -OU* -P* -RZ* -T* -W* -Y* 0-* 004* 00U* 03L* 04N* 06* 08* 0D6* 0J* 0LN* 0M* 0OG* 0P* 0Z* 1-1* 1-2* 1-J* 13S* 14* 170* 1B* 1F* 1J* 1L* 1O* 1P* 1Q2* 1U6* 1Z* 2-* 206* 21Z* 23-* 269* 26R* 27Q* 29* 2D* 2I* 2LW* 2O* 2V* 2X* 2Z* 3-0* 3-O* 321* 327* 33* 353* 37* 3AD* ...

result:

ok correct

Test #24:

score: 0
Accepted
time: 25ms
memory: 5004kb

input:

206 100
3WKWKI20 3WMBMI20 3WO8OI20 3WI6II20 3WK1KI20 3WIHII20 3WKLKI20 3WIKII20 3WK5KI20 3W2F2I20 3WTKTI20 3WK2KI20 3WMNMI20 3WO6OI20 3WKUKI20 3WKXKI20 3WILII20 3WM5MI20 3W2N2I20 3WKPKI20 3WK6KI20 3WO9OI20 3WM0MI20 3WTUTI20 3W282I20 3WKMKI20 3WO3OI20 3WM9MI20 3WTZTI20 3WIDII20 3WKCKI20 3WTGTI20 3WO0...

output:

67067 67 3W23* 3W24* 3W2C* 3W2H* 3W2J* 3W2Z* 3WI0* 3WI2* 3WI6* 3WI9* 3WIC* 3WII* 3WIK* 3WIO* 3WIS* 3WIT* 3WIW* 3WK-* 3WK2* 3WK4* 3WK8* 3WKH* 3WKJ* 3WKL* 3WKM* 3WKP* 3WKQ* 3WKS* 3WKT* 3WKW* 3WKZ* 3WM2* 3WM3* 3WM6* 3WM7* 3WME* 3WMH* 3WML* 3WMM* 3WMN* 3WMX* 3WO0* 3WO3* 3WO4* 3WO9* 3WOA* 3WOB* 3WOC* 3WO...

result:

ok correct

Test #25:

score: 0
Accepted
time: 122ms
memory: 8692kb

input:

999 100
XV0XTXAHJG XV0Z5ZAHJG XV0FIFAHJG XV0XEXAHJG XV0QTQAHJG XV07O7AHJG XV0TATAHJG XV0555AHJG XV0N7NAHJG XV07S7AHJG XV0RTRAHJG XV0TETAHJG XV0OXOAHJG XV0JVJAHJG XV07Q7AHJG XV0BKBAHJG XV0-J-AHJG XV0AOAAHJG XV07Y7AHJG XV0JQJAHJG XV09D9AHJG XV0676AHJG XV0JUJAHJG XV0-4-AHJG XV0T8TAHJG XV0434AHJG XV0RUR...

output:

255255 255 XV0-1* XV0-2* XV0-5* XV0-6* XV0-B* XV0-D* XV0-F* XV0-G* XV0-H* XV0-J* XV0-M* XV0-O* XV0-T* XV003* XV008* XV00F* XV00G* XV00N* XV00P* XV00R* XV04-* XV04B* XV04H* XV04K* XV04Q* XV04X* XV051* XV053* XV054* XV05B* XV05D* XV05G* XV05H* XV05K* XV05U* XV060* XV069* XV06A* XV06F* XV06G* XV06I* XV...

result:

ok correct

Test #26:

score: 0
Accepted
time: 1ms
memory: 4144kb

input:

2 4
A CBA
2 2 1
0
1 1
1 2

output:

2001 1 *
0 0
1001 1 A*
1001 1 C*

result:

ok correct

Test #27:

score: 0
Accepted
time: 1ms
memory: 4176kb

input:

3 8
A BA CBA
1 3
2 3 1
2 2 1
1 1
0
3 2 3 1
1 2
2 3 2

output:

1001 1 C*
2002 2 A* C*
2002 2 A* B*
1001 1 A*
0 0
3001 1 *
1001 1 B*
2001 1 *BA

result:

ok correct

Test #28:

score: 0
Accepted
time: 0ms
memory: 4204kb

input:

2 4
AB AC
1 2
1 1
0
2 1 2

output:

1001 1 AC*
1001 1 AB*
0 0
2001 1 *

result:

ok correct

Test #29:

score: 0
Accepted
time: 1ms
memory: 4140kb

input:

3 8
A AB AC
1 3
2 1 3
3 3 1 2
0
2 3 2
2 2 1
1 1
1 2

output:

1001 1 AC*
2002 2 A AC*
3001 1 *
0 0
2002 2 AB* AC*
2002 2 A AB*
1001 1 A
1001 1 AB*

result:

ok correct

Test #30:

score: 0
Accepted
time: 0ms
memory: 4144kb

input:

2 4
BA CA
1 1
2 1 2
1 2
0

output:

1001 1 B*
2001 1 *
1001 1 C*
0 0

result:

ok correct

Test #31:

score: 0
Accepted
time: 1ms
memory: 4376kb

input:

3 8
A BA CA
2 3 1
0
1 2
1 1
3 3 2 1
2 2 1
2 3 2
1 3

output:

2002 2 A* C*
0 0
1001 1 B*
1001 1 A*
3001 1 *
2002 2 A* B*
2002 2 B* C*
1001 1 C*

result:

ok correct

Test #32:

score: 0
Accepted
time: 1ms
memory: 6148kb

input:

2 4
AB C
1 2
2 2 1
1 1
0

output:

1001 1 C*
2001 1 *
1001 1 A*
0 0

result:

ok correct

Test #33:

score: 0
Accepted
time: 1ms
memory: 4148kb

input:

3 8
A AB C
2 3 2
3 1 2 3
0
1 1
1 2
1 3
2 1 3
2 1 2

output:

2002 2 AB* C*
3001 1 *
0 0
1001 1 A
1001 1 AB*
1001 1 C*
2002 2 A C*
2001 1 A*

result:

ok correct

Test #34:

score: 0
Accepted
time: 1ms
memory: 4336kb

input:

3 8
A BA C
2 3 2
0
3 1 3 2
2 1 2
1 1
1 2
2 1 3
1 3

output:

2002 2 B* C*
0 0
3001 1 *
2001 1 *A
1001 1 A*
1001 1 B*
2002 2 A* C*
1001 1 C*

result:

ok correct

Test #35:

score: 0
Accepted
time: 1ms
memory: 4244kb

input:

4 16
A B C D
2 2 1
1 1
2 3 2
1 2
0
3 3 1 2
2 1 3
4 2 3 1 4
2 4 2
3 1 2 4
3 1 3 4
2 4 1
1 4
2 4 3
1 3
3 2 4 3

output:

2002 2 A* B*
1001 1 A*
2002 2 B* C*
1001 1 B*
0 0
3003 3 A* B* C*
2002 2 A* C*
4001 1 *
2002 2 B* D*
3003 3 A* B* D*
3003 3 A* C* D*
2002 2 A* D*
1001 1 D*
2002 2 C* D*
1001 1 C*
3003 3 B* C* D*

result:

ok correct

Test #36:

score: 0
Accepted
time: 1ms
memory: 4160kb

input:

3 8
AB AC AD
0
2 1 3
1 1
3 2 3 1
1 3
1 2
2 1 2
2 3 2

output:

0 0
2002 2 AB* AD*
1001 1 AB*
3001 1 *
1001 1 AD*
1001 1 AC*
2002 2 AB* AC*
2002 2 AC* AD*

result:

ok correct

Test #37:

score: 0
Accepted
time: 1ms
memory: 4172kb

input:

4 16
A AB AC AD
2 2 4
2 1 3
3 4 2 3
2 2 1
3 1 2 3
2 3 4
4 1 3 4 2
2 4 1
3 1 4 2
1 4
0
1 1
1 3
1 2
3 1 4 3
2 2 3

output:

2002 2 AB* AD*
2002 2 A AC*
3003 3 AB* AC* AD*
2002 2 A AB*
3003 3 A AB* AC*
2002 2 AC* AD*
4001 1 *
2002 2 A AD*
3003 3 A AB* AD*
1001 1 AD*
0 0
1001 1 A
1001 1 AC*
1001 1 AB*
3003 3 A AC* AD*
2002 2 AB* AC*

result:

ok correct

Test #38:

score: 0
Accepted
time: 1ms
memory: 4372kb

input:

3 8
BA CA DA
3 1 3 2
2 2 1
1 1
1 3
2 3 2
2 3 1
0
1 2

output:

3001 1 *
2002 2 B* C*
1001 1 B*
1001 1 D*
2002 2 C* D*
2002 2 B* D*
0 0
1001 1 C*

result:

ok correct

Test #39:

score: 0
Accepted
time: 1ms
memory: 4180kb

input:

4 16
A BA CA DA
1 1
3 4 3 1
1 2
2 1 4
2 1 3
1 3
2 3 4
0
1 4
3 4 2 3
2 2 3
3 1 2 4
2 1 2
4 4 3 2 1
2 4 2
3 1 2 3

output:

1001 1 A*
3003 3 A* C* D*
1001 1 B*
2002 2 A* D*
2002 2 A* C*
1001 1 C*
2002 2 C* D*
0 0
1001 1 D*
3003 3 B* C* D*
2002 2 B* C*
3003 3 A* B* D*
2002 2 A* B*
4001 1 *
2002 2 B* D*
3003 3 A* B* C*

result:

ok correct

Test #40:

score: 0
Accepted
time: 1ms
memory: 4244kb

input:

3 8
AB C D
1 2
2 2 1
1 1
2 3 2
1 3
0
2 3 1
3 2 1 3

output:

1001 1 C*
2002 2 A* C*
1001 1 A*
2002 2 C* D*
1001 1 D*
0 0
2002 2 A* D*
3001 1 *

result:

ok correct

Test #41:

score: 0
Accepted
time: 0ms
memory: 4332kb

input:

4 16
A AB C D
4 3 2 4 1
2 4 2
3 2 3 4
1 1
2 3 4
1 4
1 2
3 3 1 4
3 1 2 4
3 2 1 3
2 1 2
1 3
2 1 3
2 2 3
2 1 4
0

output:

4001 1 *
2002 2 AB* D*
3003 3 AB* C* D*
1001 1 A
2002 2 C* D*
1001 1 D*
1001 1 AB*
3003 3 A C* D*
3002 2 A* D*
3002 2 A* C*
2001 1 A*
1001 1 C*
2002 2 A C*
2002 2 AB* C*
2002 2 A D*
0 0

result:

ok correct

Test #42:

score: 0
Accepted
time: 1ms
memory: 4336kb

input:

4 16
A BA C D
2 4 1
1 1
2 3 4
3 3 1 2
4 4 2 3 1
3 3 1 4
1 4
2 2 1
3 2 1 4
3 4 3 2
2 2 3
2 1 3
0
1 2
1 3
2 2 4

output:

2002 2 A* D*
1001 1 A*
2002 2 C* D*
3002 2 C* *A
4001 1 *
3003 3 A* C* D*
1001 1 D*
2001 1 *A
3002 2 D* *A
3003 3 B* C* D*
2002 2 B* C*
2002 2 A* C*
0 0
1001 1 B*
1001 1 C*
2002 2 B* D*

result:

ok correct

Test #43:

score: 0
Accepted
time: 1ms
memory: 4132kb

input:

3 8
AB AC D
1 3
2 1 3
2 2 3
0
3 3 2 1
1 2
2 1 2
1 1

output:

1001 1 D*
2002 2 AB* D*
2002 2 AC* D*
0 0
3001 1 *
1001 1 AC*
2001 1 A*
1001 1 AB*

result:

ok correct

Test #44:

score: 0
Accepted
time: 0ms
memory: 4088kb

input:

4 16
A AB AC D
3 1 3 2
2 1 4
0
1 3
2 3 4
4 1 2 4 3
3 1 4 2
2 3 1
2 3 2
1 1
2 4 2
1 2
3 4 1 3
1 4
2 2 1
3 3 4 2

output:

3001 1 A*
2002 2 A D*
0 0
1001 1 AC*
2002 2 AC* D*
4001 1 *
3003 3 A AB* D*
2002 2 A AC*
2002 2 AB* AC*
1001 1 A
2002 2 AB* D*
1001 1 AB*
3003 3 A AC* D*
1001 1 D*
2002 2 A AB*
3003 3 AB* AC* D*

result:

ok correct

Test #45:

score: 0
Accepted
time: 1ms
memory: 4084kb

input:

3 8
BA CA D
3 1 3 2
1 3
0
2 3 1
1 2
1 1
2 2 1
2 3 2

output:

3001 1 *
1001 1 D*
0 0
2002 2 B* D*
1001 1 C*
1001 1 B*
2001 1 *A
2002 2 C* D*

result:

ok correct

Test #46:

score: 0
Accepted
time: 1ms
memory: 4244kb

input:

4 16
A BA CA D
2 1 4
2 1 3
3 3 4 1
2 2 3
1 3
2 2 4
1 2
2 2 1
3 4 3 2
1 1
3 2 4 1
3 1 2 3
2 4 3
0
1 4
4 1 2 4 3

output:

2002 2 A* D*
2002 2 A* C*
3003 3 A* C* D*
2002 2 B* C*
1001 1 C*
2002 2 B* D*
1001 1 B*
2002 2 A* B*
3003 3 B* C* D*
1001 1 A*
3003 3 A* B* D*
3001 1 *A
2002 2 C* D*
0 0
1001 1 D*
4001 1 *

result:

ok correct

Test #47:

score: 0
Accepted
time: 1ms
memory: 4152kb

input:

2 4
AB CD
2 2 1
0
1 2
1 1

output:

2001 1 *
0 0
1001 1 C*
1001 1 A*

result:

ok correct

Test #48:

score: 0
Accepted
time: 1ms
memory: 4384kb

input:

3 8
A AB CD
2 2 3
1 1
3 3 1 2
1 2
1 3
0
2 1 2
2 3 1

output:

2002 2 AB* C*
1001 1 A
3001 1 *
1001 1 AB*
1001 1 C*
0 0
2001 1 A*
2002 2 A C*

result:

ok correct

Test #49:

score: 0
Accepted
time: 0ms
memory: 4152kb

input:

3 8
C AB CD
1 1
3 2 1 3
1 3
0
2 1 3
2 3 2
1 2
2 1 2

output:

1001 1 C
3001 1 *
1001 1 CD*
0 0
2001 1 C*
2002 2 A* CD*
1001 1 A*
2002 2 A* C

result:

ok correct

Test #50:

score: 0
Accepted
time: 0ms
memory: 4152kb

input:

4 16
A C AB CD
3 2 1 4
3 2 4 3
2 1 2
0
2 3 2
2 3 1
1 2
1 4
2 4 1
2 4 2
4 1 4 3 2
2 4 3
3 4 3 1
3 1 2 3
1 3
1 1

output:

3002 2 A C*
3002 2 AB* C*
2002 2 A C
0 0
2002 2 AB* C
2001 1 A*
1001 1 C
1001 1 CD*
2002 2 A CD*
2001 1 C*
4001 1 *
2002 2 AB* CD*
3002 2 A* CD*
3002 2 A* C
1001 1 AB*
1001 1 A

result:

ok correct

Test #51:

score: 0
Accepted
time: 1ms
memory: 4376kb

input:

3 8
A BA DC
0
3 1 2 3
2 1 3
1 1
2 2 3
2 1 2
1 2
1 3

output:

0 0
3001 1 *
2002 2 A* D*
1001 1 A*
2002 2 B* D*
2001 1 *A
1001 1 B*
1001 1 D*

result:

ok correct

Test #52:

score: 0
Accepted
time: 1ms
memory: 4144kb

input:

3 8
C BA DC
3 2 3 1
0
1 3
2 3 1
1 2
2 1 2
2 3 2
1 1

output:

3001 1 *
0 0
1001 1 D*
2001 1 *C
1001 1 B*
2002 2 B* C*
2002 2 B* D*
1001 1 C*

result:

ok correct

Test #53:

score: 0
Accepted
time: 1ms
memory: 4236kb

input:

4 16
A C BA DC
2 1 2
3 4 2 1
1 1
1 2
1 3
3 3 4 2
4 2 4 1 3
2 2 3
2 4 1
2 1 3
1 4
2 3 4
3 1 3 4
0
2 4 2
3 3 1 2

output:

2002 2 A* C*
3002 2 A* *C
1001 1 A*
1001 1 C*
1001 1 B*
3002 2 B* *C
4001 1 *
2002 2 B* C*
2002 2 A* D*
2001 1 *A
1001 1 D*
2002 2 B* D*
3002 2 D* *A
0 0
2001 1 *C
3002 2 C* *A

result:

ok correct

Test #54:

score: 0
Accepted
time: 0ms
memory: 4368kb

input:

2 4
ABC D
1 2
0
1 1
2 1 2

output:

1001 1 D*
0 0
1001 1 A*
2001 1 *

result:

ok correct

Test #55:

score: 0
Accepted
time: 0ms
memory: 4156kb

input:

3 8
AB ABC D
1 2
0
3 3 2 1
1 1
2 1 2
2 3 1
2 3 2
1 3

output:

1001 1 ABC*
0 0
3001 1 *
1001 1 AB
2001 1 A*
2002 2 AB D*
2002 2 ABC* D*
1001 1 D*

result:

ok correct

Test #56:

score: 0
Accepted
time: 0ms
memory: 4176kb

input:

3 8
A ABC D
2 2 3
1 1
2 1 3
1 2
0
2 2 1
3 3 1 2
1 3

output:

2002 2 AB* D*
1001 1 A
2002 2 A D*
1001 1 AB*
0 0
2001 1 A*
3001 1 *
1001 1 D*

result:

ok correct

Test #57:

score: 0
Accepted
time: 1ms
memory: 4368kb

input:

4 16
A AB ABC D
1 3
1 2
4 1 3 4 2
2 2 1
2 2 3
1 1
2 1 3
3 2 1 4
3 4 1 3
0
2 2 4
1 4
3 3 1 2
2 4 1
2 4 3
3 4 2 3

output:

1001 1 ABC*
1001 1 AB
4001 1 *
2002 2 A AB
2001 1 AB*
1001 1 A
2002 2 A ABC*
3003 3 A AB D*
3003 3 A ABC* D*
0 0
2002 2 AB D*
1001 1 D*
3001 1 A*
2002 2 A D*
2002 2 ABC* D*
3002 2 AB* D*

result:

ok correct

Test #58:

score: 0
Accepted
time: 1ms
memory: 4172kb

input:

3 8
BA CBA D
3 3 1 2
2 2 3
0
1 3
1 2
2 1 2
2 3 1
1 1

output:

3001 1 *
2002 2 C* D*
0 0
1001 1 D*
1001 1 C*
2001 1 *A
2002 2 B* D*
1001 1 B*

result:

ok correct

Test #59:

score: 0
Accepted
time: 1ms
memory: 6280kb

input:

3 8
A CBA D
3 3 2 1
1 1
0
2 2 1
1 2
2 2 3
1 3
2 1 3

output:

3001 1 *
1001 1 A*
0 0
2001 1 *A
1001 1 C*
2002 2 C* D*
1001 1 D*
2002 2 A* D*

result:

ok correct

Test #60:

score: 0
Accepted
time: 1ms
memory: 4180kb

input:

4 16
A BA CBA D
2 3 2
2 4 1
1 3
1 4
2 2 4
0
3 1 2 4
3 1 2 3
1 1
2 2 1
1 2
4 1 4 2 3
2 1 3
3 3 2 4
3 1 4 3
2 3 4

output:

2001 1 *BA
2002 2 A* D*
1001 1 C*
1001 1 D*
2002 2 B* D*
0 0
3003 3 A* B* D*
3001 1 *A
1001 1 A*
2002 2 A* B*
1001 1 B*
4001 1 *
2002 2 A* C*
3002 2 D* *BA
3003 3 A* C* D*
2002 2 C* D*

result:

ok correct

Test #61:

score: 0
Accepted
time: 1ms
memory: 4080kb

input:

2 4
ABC AD
1 2
0
1 1
2 2 1

output:

1001 1 AD*
0 0
1001 1 AB*
2001 1 *

result:

ok correct

Test #62:

score: 0
Accepted
time: 0ms
memory: 4140kb

input:

3 8
AB ABC AD
1 2
1 1
3 2 3 1
2 2 3
1 3
0
2 3 1
2 2 1

output:

1001 1 ABC*
1001 1 AB
3001 1 *
2002 2 ABC* AD*
1001 1 AD*
0 0
2002 2 AB AD*
2001 1 AB*

result:

ok correct

Test #63:

score: 0
Accepted
time: 1ms
memory: 4252kb

input:

3 8
A ABC AD
1 1
2 1 3
2 3 2
1 2
1 3
2 2 1
0
3 2 3 1

output:

1001 1 A
2002 2 A AD*
2002 2 AB* AD*
1001 1 AB*
1001 1 AD*
2002 2 A AB*
0 0
3001 1 *

result:

ok correct

Test #64:

score: 0
Accepted
time: 1ms
memory: 4152kb

input:

4 16
A AB ABC AD
1 1
3 4 2 3
2 3 2
2 1 3
1 3
3 1 3 2
2 1 2
2 4 3
1 2
3 3 1 4
2 1 4
0
3 2 1 4
2 4 2
1 4
4 1 4 2 3

output:

1001 1 A
3002 2 AB* AD*
2001 1 AB*
2002 2 A ABC*
1001 1 ABC*
3002 2 A AB*
2002 2 A AB
2002 2 ABC* AD*
1001 1 AB
3003 3 A ABC* AD*
2002 2 A AD*
0 0
3003 3 A AB AD*
2002 2 AB AD*
1001 1 AD*
4001 1 *

result:

ok correct

Test #65:

score: 0
Accepted
time: 1ms
memory: 4180kb

input:

2 4
CBA DA
0
1 2
1 1
2 1 2

output:

0 0
1001 1 D*
1001 1 C*
2001 1 *

result:

ok correct

Test #66:

score: 0
Accepted
time: 1ms
memory: 4112kb

input:

3 8
BA CBA DA
1 1
2 3 2
1 3
3 1 3 2
0
1 2
2 1 2
2 1 3

output:

1001 1 B*
2002 2 C* D*
1001 1 D*
3001 1 *
0 0
1001 1 C*
2001 1 *BA
2002 2 B* D*

result:

ok correct

Test #67:

score: 0
Accepted
time: 1ms
memory: 4248kb

input:

3 8
A CBA DA
1 2
1 1
0
2 1 2
2 3 1
2 2 3
3 2 1 3
1 3

output:

1001 1 C*
1001 1 A*
0 0
2002 2 A* C*
2002 2 A* D*
2002 2 C* D*
3001 1 *
1001 1 D*

result:

ok correct

Test #68:

score: 0
Accepted
time: 1ms
memory: 4340kb

input:

4 16
A BA CBA DA
1 3
3 3 1 2
2 2 4
2 3 1
2 4 1
4 4 1 3 2
1 1
2 3 4
3 2 4 3
3 4 1 3
2 3 2
3 4 2 1
1 4
0
2 1 2
1 2

output:

1001 1 C*
3002 2 A* *BA
2002 2 B* D*
2002 2 A* C*
2002 2 A* D*
4001 1 *
1001 1 A*
2002 2 C* D*
3002 2 D* *BA
3003 3 A* C* D*
2001 1 *BA
3003 3 A* B* D*
1001 1 D*
0 0
2002 2 A* B*
1001 1 B*

result:

ok correct

Test #69:

score: 0
Accepted
time: 1ms
memory: 4248kb

input:

2 4
ABC ABD
2 1 2
1 1
1 2
0

output:

2001 1 *
1001 1 ABC*
1001 1 ABD*
0 0

result:

ok correct

Test #70:

score: 0
Accepted
time: 1ms
memory: 4304kb

input:

3 8
AB ABC ABD
2 3 1
0
1 2
2 1 2
2 2 3
1 3
1 1
3 2 3 1

output:

2002 2 AB ABD*
0 0
1001 1 ABC*
2002 2 AB ABC*
2002 2 ABC* ABD*
1001 1 ABD*
1001 1 AB
3001 1 *

result:

ok correct

Test #71:

score: 0
Accepted
time: 1ms
memory: 4148kb

input:

3 8
A ABC ABD
2 2 1
2 2 3
0
1 3
3 3 2 1
2 1 3
1 2
1 1

output:

2002 2 A ABC*
2001 1 AB*
0 0
1001 1 ABD*
3001 1 *
2002 2 A ABD*
1001 1 ABC*
1001 1 A

result:

ok correct

Test #72:

score: 0
Accepted
time: 1ms
memory: 4372kb

input:

4 16
A AB ABC ABD
2 2 1
2 2 4
1 4
3 4 2 3
4 2 4 1 3
1 1
2 1 3
1 2
2 1 4
2 3 4
3 2 3 1
0
3 2 4 1
3 3 4 1
1 3
2 3 2

output:

2002 2 A AB
2002 2 AB ABD*
1001 1 ABD*
3001 1 AB*
4001 1 *
1001 1 A
2002 2 A ABC*
1001 1 AB
2002 2 A ABD*
2002 2 ABC* ABD*
3003 3 A AB ABC*
0 0
3003 3 A AB ABD*
3003 3 A ABC* ABD*
1001 1 ABC*
2002 2 AB ABC*

result:

ok correct

Test #73:

score: 0
Accepted
time: 1ms
memory: 4176kb

input:

2 4
CBA DBA
2 2 1
1 1
1 2
0

output:

2001 1 *
1001 1 C*
1001 1 D*
0 0

result:

ok correct

Test #74:

score: 0
Accepted
time: 1ms
memory: 4340kb

input:

3 8
BA CBA DBA
2 3 2
2 2 1
1 3
2 3 1
1 1
3 1 2 3
1 2
0

output:

2002 2 C* D*
2002 2 B* C*
1001 1 D*
2002 2 B* D*
1001 1 B*
3001 1 *
1001 1 C*
0 0

result:

ok correct

Test #75:

score: 0
Accepted
time: 1ms
memory: 4180kb

input:

3 8
A CBA DBA
2 1 2
0
1 2
3 1 3 2
2 1 3
2 2 3
1 3
1 1

output:

2002 2 A* C*
0 0
1001 1 C*
3001 1 *
2002 2 A* D*
2001 1 *BA
1001 1 D*
1001 1 A*

result:

ok correct

Test #76:

score: 0
Accepted
time: 1ms
memory: 4176kb

input:

4 16
A BA CBA DBA
3 1 4 2
2 1 4
1 3
1 1
2 2 3
4 1 4 2 3
2 2 1
2 3 1
3 4 1 3
3 2 1 3
2 4 2
1 2
3 4 2 3
1 4
2 3 4
0

output:

3003 3 A* B* D*
2002 2 A* D*
1001 1 C*
1001 1 A*
2002 2 B* C*
4001 1 *
2002 2 A* B*
2002 2 A* C*
3003 3 A* C* D*
3003 3 A* B* C*
2002 2 B* D*
1001 1 B*
3001 1 *BA
1001 1 D*
2002 2 C* D*
0 0

result:

ok correct

Test #77:

score: 0
Accepted
time: 1ms
memory: 4088kb

input:

1 2
ABCD
0
1 1

output:

0 0
1001 1 *

result:

ok correct

Test #78:

score: 0
Accepted
time: 1ms
memory: 4104kb

input:

2 4
ABCD ABC
0
2 2 1
1 1
1 2

output:

0 0
2001 1 *
1001 1 ABCD*
1001 1 ABC

result:

ok correct

Test #79:

score: 0
Accepted
time: 1ms
memory: 4184kb

input:

2 4
ABCD AB
2 1 2
1 2
0
1 1

output:

2001 1 *
1001 1 AB
0 0
1001 1 ABC*

result:

ok correct

Test #80:

score: 0
Accepted
time: 0ms
memory: 4152kb

input:

3 8
ABCD AB ABC
1 3
0
2 1 3
1 2
2 2 1
2 3 2
1 1
3 1 2 3

output:

1001 1 ABC
0 0
2001 1 ABC*
1001 1 AB
2002 2 AB ABCD*
2002 2 AB ABC
1001 1 ABCD*
3001 1 *

result:

ok correct

Test #81:

score: 0
Accepted
time: 0ms
memory: 6092kb

input:

2 4
ABCD A
1 2
2 2 1
0
1 1

output:

1001 1 A
2001 1 *
0 0
1001 1 AB*

result:

ok correct

Test #82:

score: 0
Accepted
time: 1ms
memory: 4180kb

input:

3 8
ABCD A ABC
2 1 2
1 2
1 3
2 2 3
3 1 2 3
0
2 1 3
1 1

output:

2002 2 A ABCD*
1001 1 A
1001 1 ABC
2002 2 A ABC
3001 1 *
0 0
2001 1 AB*
1001 1 ABCD*

result:

ok correct

Test #83:

score: 0
Accepted
time: 0ms
memory: 4176kb

input:

3 8
ABCD A AB
2 3 2
1 1
2 1 3
2 1 2
3 2 1 3
0
1 2
1 3

output:

2002 2 A AB
1001 1 ABC*
2001 1 AB*
2002 2 A ABC*
3001 1 *
0 0
1001 1 A
1001 1 AB

result:

ok correct

Test #84:

score: 0
Accepted
time: 1ms
memory: 4236kb

input:

4 16
ABCD A AB ABC
2 1 4
1 4
2 4 3
2 2 4
3 3 2 4
4 3 1 2 4
1 2
0
3 3 2 1
1 3
3 1 2 4
1 1
3 1 4 3
2 2 3
2 3 1
2 2 1

output:

2001 1 ABC*
1001 1 ABC
2002 2 AB ABC
2002 2 A ABC
3003 3 A AB ABC
4001 1 *
1001 1 A
0 0
3003 3 A AB ABCD*
1001 1 AB
3002 2 A ABC*
1001 1 ABCD*
3001 1 AB*
2002 2 A AB
2002 2 AB ABCD*
2002 2 A ABCD*

result:

ok correct

Test #85:

score: 0
Accepted
time: 1ms
memory: 4376kb

input:

2 4
DCBA CBA
1 2
2 1 2
0
1 1

output:

1001 1 C*
2001 1 *
0 0
1001 1 D*

result:

ok correct

Test #86:

score: 0
Accepted
time: 1ms
memory: 4156kb

input:

2 4
DCBA BA
1 2
0
2 2 1
1 1

output:

1001 1 B*
0 0
2001 1 *
1001 1 D*

result:

ok correct

Test #87:

score: 0
Accepted
time: 1ms
memory: 4108kb

input:

3 8
DCBA BA CBA
0
3 2 3 1
2 2 3
1 2
2 3 1
1 3
2 1 2
1 1

output:

0 0
3001 1 *
2002 2 B* C*
1001 1 B*
2001 1 *CBA
1001 1 C*
2002 2 B* D*
1001 1 D*

result:

ok correct

Test #88:

score: 0
Accepted
time: 1ms
memory: 4144kb

input:

2 4
DCBA A
1 1
2 1 2
0
1 2

output:

1001 1 D*
2001 1 *
0 0
1001 1 A*

result:

ok correct

Test #89:

score: 0
Accepted
time: 0ms
memory: 4080kb

input:

3 8
DCBA A CBA
2 2 1
3 2 3 1
1 2
2 1 3
2 2 3
0
1 1
1 3

output:

2002 2 A* D*
3001 1 *
1001 1 A*
2001 1 *BA
2002 2 A* C*
0 0
1001 1 D*
1001 1 C*

result:

ok correct

Test #90:

score: 0
Accepted
time: 0ms
memory: 4176kb

input:

3 8
DCBA A BA
2 2 3
0
1 1
2 2 1
3 1 2 3
1 2
1 3
2 1 3

output:

2002 2 A* B*
0 0
1001 1 D*
2002 2 A* D*
3001 1 *
1001 1 A*
1001 1 B*
2001 1 *BA

result:

ok correct

Test #91:

score: 0
Accepted
time: 0ms
memory: 4180kb

input:

4 16
DCBA A BA CBA
4 3 1 4 2
2 1 3
3 4 3 1
1 4
1 2
2 4 2
3 2 3 1
2 4 1
2 1 2
1 3
0
3 3 4 2
1 1
2 3 2
3 2 4 1
2 4 3

output:

4001 1 *
2002 2 B* D*
3001 1 *BA
1001 1 C*
1001 1 A*
2002 2 A* C*
3003 3 A* B* D*
2001 1 *CBA
2002 2 A* D*
1001 1 B*
0 0
3003 3 A* B* C*
1001 1 D*
2002 2 A* B*
3002 2 A* *CBA
2002 2 B* C*

result:

ok correct

Test #92:

score: 0
Accepted
time: 0ms
memory: 4172kb

input:

3 8
AB B BC
3 1 3 2
1 3
2 3 2
2 3 1
1 2
1 1
0
2 2 1

output:

3001 1 *
1001 1 BC*
2001 1 B*
2002 2 A* BC*
1001 1 B
1001 1 A*
0 0
2001 1 *B

result:

ok correct

Test #93:

score: 0
Accepted
time: 1ms
memory: 4340kb

input:

6 64
A AA AAA AAAA AAAAA AAAAAA
2 2 6
3 3 4 6
1 4
4 2 5 6 4
4 1 3 2 5
2 1 4
3 2 4 5
2 6 1
3 5 2 3
3 3 4 2
5 2 5 3 1 6
3 6 5 1
3 2 1 4
4 6 1 4 5
3 1 3 6
4 1 4 3 5
1 3
1 5
4 3 6 1 4
4 4 3 6 5
3 6 4 2
2 2 1
1 1
4 2 4 6 1
2 2 4
0
3 4 3 1
4 2 4 3 6
2 3 5
3 1 5 4
3 6 4 1
5 1 5 4 2 6
6 1 2 5 3 4 6
4 2 5 4 ...

output:

2002 2 AA AAAAAA*
3003 3 AAA AAAA AAAAAA*
1001 1 AAAA
4002 2 AA AAAA*
4004 4 A AA AAA AAAAA
2002 2 A AAAA
3003 3 AA AAAA AAAAA
2002 2 A AAAAAA*
3003 3 AA AAA AAAAA
3003 3 AA AAA AAAA
5004 4 A AA AAA AAAAA*
3002 2 A AAAAA*
3003 3 A AA AAAA
4002 2 A AAAA*
3003 3 A AAA AAAAAA*
4004 4 A AAA AAAA AAAAA
1...

result:

ok correct

Test #94:

score: 0
Accepted
time: 1ms
memory: 4336kb

input:

6 64
A AA AAB ABB BB B
3 1 6 2
3 5 3 1
3 5 6 3
3 2 3 1
2 3 1
6 3 6 5 1 4 2
2 4 3
2 6 3
4 6 5 3 2
3 4 1 5
3 2 5 4
4 4 1 5 6
5 4 1 6 5 2
2 2 1
4 1 3 6 5
3 6 1 5
5 6 5 4 3 1
4 3 2 1 4
1 2
4 4 3 6 1
3 3 6 4
4 3 6 1 2
5 3 6 2 4 5
3 4 3 5
2 1 5
2 2 6
3 4 1 6
3 5 6 2
5 3 2 4 1 5
3 5 6 4
2 4 6
4 1 2 4 6
4 5...

output:

3002 2 B *A
3003 3 A AAB* BB*
3002 2 AAB* B*
3002 2 A AA*
2002 2 A AAB*
6001 1 *
2002 2 AAB* AB*
2002 2 AAB* B
4002 2 AA* B*
3002 2 A *BB
3002 2 AA *BB
4003 3 A AB* B*
5003 3 AB* B* *A
2001 1 *A
4003 3 A AAB* B*
3002 2 A B*
5002 2 A *B
4001 1 A*
1001 1 AA
4004 4 A AAB* AB* B
3003 3 AAB* AB* B
4003 3...

result:

ok correct

Test #95:

score: 0
Accepted
time: 1ms
memory: 4088kb

input:

5 32
ABC BC C CB CBA
2 4 1
3 5 2 1
1 5
3 3 4 5
1 1
2 3 2
2 2 5
1 3
3 3 1 2
2 1 2
1 4
4 4 2 1 5
3 3 2 5
1 2
2 4 2
3 5 4 2
2 1 5
4 1 5 3 2
2 5 4
3 5 3 1
4 1 5 4 3
3 1 2 4
0
3 1 5 4
2 3 1
2 5 3
2 4 3
4 4 1 3 2
3 4 3 2
5 3 1 2 4 5
3 1 3 4
4 4 2 3 5

output:

2002 2 A* CB
3002 2 CBA* *BC
1001 1 CBA*
3001 1 C*
1001 1 A*
2002 2 B* C
2002 2 B* CBA*
1001 1 C
3001 1 *C
2001 1 *BC
1001 1 CB
4002 2 CB* *BC
3003 3 B* C CBA*
1001 1 B*
2002 2 B* CB
3002 2 B* CB*
2002 2 A* CBA*
4002 2 CBA* *C
2001 1 CB*
3003 3 A* C CBA*
4002 2 A* C*
3002 2 CB *BC
0 0
3002 2 A* CB*
...

result:

ok correct

Test #96:

score: 0
Accepted
time: 1ms
memory: 4156kb

input:

6 64
ABCD BCD CD D DC DCB
4 2 6 5 4
3 5 2 6
6 5 3 2 6 1 4
2 1 5
3 6 2 4
2 6 4
4 5 4 3 1
3 6 1 2
0
3 3 2 4
3 1 2 4
5 2 5 1 4 6
2 5 4
4 4 2 6 1
2 1 4
4 1 6 2 3
3 5 6 1
3 1 2 5
2 6 2
3 3 5 6
1 4
1 6
3 4 5 2
3 2 6 3
2 3 6
5 1 4 3 5 2
4 1 5 4 6
3 5 1 4
2 6 5
2 4 2
2 3 5
5 3 6 5 4 1
1 2
3 1 4 6
4 2 6 3 5
...

output:

4002 2 B* D*
3002 2 B* DC*
6001 1 *
2002 2 A* DC
3003 3 B* D DCB*
2002 2 D DCB*
4004 4 A* C* D DC
3002 2 DCB* *BCD
0 0
3003 3 B* C* D
3002 2 D *BCD
5002 2 D* *BCD
2002 2 D DC
4003 3 D DCB* *BCD
2002 2 A* D
4002 2 DCB* *CD
3002 2 A* DC*
3002 2 DC *BCD
2002 2 B* DCB*
3002 2 C* DC*
1001 1 D
1001 1 DCB*...

result:

ok correct

Test #97:

score: 0
Accepted
time: 213ms
memory: 11412kb

input:

1000 100
OAA9YQ5VOZ H4G8T8-AWG 2V8J2DY88H VOTJRYQHSC JIV57RYB4I CKDA7GCT-F 59OT9PN7MV E55SCNCHOI 3QRSJ1Z165 D2LZJ6KCM1 1AZ8X8XYNA UN1EIVMEU6 -6GLAQ459B 4U39QLQWYM 4376K3Z-G6 GO8CUD2615 VDQMQBZD56 PYD65T3YN0 F0HP5LJKAF S8TW3-7HKX 6BLTEOO1VL UZOMT710K1 URAD3ML3W4 S9D6J09WJS M9X7FHI-CT YLWMGUUBBA -MEF0...

output:

506414 414 -6* -90* -D* -IG* -IL* -IZ* -J* -R* -S* -T* -W8* -Z* 02* 07Y* 08* 0K* 0L* 0M* 0TJ* 0TX* 0V* 1-* 10* 11* 12* 16* 1A* 1BT* 1DS* 1F* 1XM* 25G* 27* 283* 2AM* 2B* 2G* 2L* 2S8* 2VR* 30R* 31T* 39* 3D* 3I1* 3Q* 3T* 3V* 43* 46* 48* 49* 4E* 4HL* 4MN* 4N* 4P* 4Q* 4U* 4X* 59F* 5DC* 5G* 5JL* 5X* 5Y* 5...

result:

ok correct

Test #98:

score: 0
Accepted
time: 37ms
memory: 5412kb

input:

629 100
AABAAABABB BABABABAAA BBBBAABAAB AABBBBBAAB BAABBAABAA BABBBBBABA ABAAAABABB AABAAAAABB BABABBBBAB BBABBBABAA BAABBBABAA ABBBBABBAA BBBABBAAAB BBBBAABAAA ABABAABABA AAABAAAAAB ABAABBABBA ABBABBBBAB BBBAAAABBB BBBAABABBA BABBBABBAA AAABAABBBA BBBABBBABB BABBBBBAAB AAABBABBAB AAAABAABBB ABABBB...

output:

316209 209 AAAAAAABAB* AAAAAAABB* AAAAABAAB* AAAAABABBA* AAAABABAAB* AAAABBAABB* AAAABBABA* AAAABBBAA* AAAABBBBA* AAAABBBBBA* AAABAAAAA* AAABAABB* AAABABAAAB* AAABABABBB* AAABBAAAA* AAABBAAABA* AAABBABBAB* AAABBBAAA* AAABBBBA* AABAAAAAB* AABAAABB* AABAABAAB* AABAABBBBA* AABABAAABB* AABABAAB* AABABBA...

result:

ok correct

Test #99:

score: 0
Accepted
time: 111ms
memory: 7968kb

input:

997 100
BABBAABBCB CBCCBACCCA CABACCCBBB BBACABACAA CCCBBCBABC ACCAAACBCC CCCABBBABC CCBABCABBB ABABAABCBB ABACAAABAB ACABCCBBAB BABCABCAAC CCCBABBAAB ABCBCCBABC BBACCCCBBB CAAABBACCC CACAACCAAA BCCCBAABAB CAACCCBCCA CBABBBCCCB CBCACBCBAB ABACCBCBCB ABBCCCCCAA CBCCBABBCA BCABCBBCCB CBAACCBCBC BCBABA...

output:

482337 337 AAAACBCB* AAABAAC* AAABABA* AAABBB* AAACAB* AAACACAC* AAACBBA* AAACCC* AABAABC* AABABAA* AABBBCA* AABBC* AABCA* AABCC* AACACA* AACACC* AACBAC* AACBBA* AACBCBB* AACBCC* AACCAAA* AACCBC* AACCC* ABAAB* ABAACABC* ABABAABC* ABABABA* ABABABCC* ABABBBAABA* ABABBC* ABABCC* ABACAAA* ABACAAC* ABACA...

result:

ok correct

Test #100:

score: 0
Accepted
time: 159ms
memory: 9360kb

input:

1000 100
ADACDEFBF DGGCFBCGF DCGEBCGFC EBDFDCFDD FEDGCAFAG AEBBBFDDB AGGEAEGDF BBACFECCD CDFBBEDCA AGBBAEDBC BCDDGECGE CDGEFEBGA DBGBFGCBA DEABECGDD GDCGBDEEE FEAGEDCAE AGBFABAED FFBBEFEDF DFGBEGEGE CBGBGECAD BADGECBGE DCGBCBEEE ADGAABFFA EEECABDFD FAEEAABBE FEDEDEFFG DFFBGEDEE AACACFAFG BGGFBCBEG D...

output:

501356 356 AAAB* AAAF* AABFBB* AACDF* AACG* AADB* AAE* AAF* AAGF* ABAA* ABBA* ACA* ACBFE* ACCD* ACDA* ACDD* ACFCG* ACG* ADAB* ADAF* ADBDG* ADBG* ADCB* ADCD* ADCEB* ADDAB* ADEB* ADEF* ADF* AEBB* AEBF* AFBD* AFDB* AFDC* AFDG* AFE* AFFE* AFGA* AGBB* AGBD* AGC* AGD* AGEA* AGEB* AGEC* AGEF* AGEG* AGF* AG...

result:

ok correct

Test #101:

score: 0
Accepted
time: 201ms
memory: 10540kb

input:

1000 100
JEEFFJADAF JHCCFJBGFE EAHJCDDBBE GJBHAHJAFF HJCHDIFBEI CICBGFDDHC GHJFGBFAAC DGBFFDFGEE BJHBAGBJAA FAFJCBAJEC JCJJHGIBGI IIIEGDCCBB GEJCHAADDG FFFECHBFHJ IHCEIJEGEI GBEHDBADDA FHJFIDJAJA GCDHDCIABJ CDEFJBCFFB DJFCGCJGGB JJBFEECBAG DJCABDHCJB DEGGHHBCID AGJEGIEDFI CHIJCAJDBG EDIDHCDGGF EFGEE...

output:

487381 381 AAA* AAFA* AAJD* ABA* ABF* ACA* ACEH* ACG* ACH* ACIC* ACJ* ADBF* ADBI* ADBJ* ADDI* ADFF* ADJC* ADJF* AEAE* AEDD* AEE* AEFAD* AEJ* AFE* AFGB* AFH* AFID* AGA* AGC* AGF* AGJD* AHAB* AHAJ* AHBG* AHF* AHHF* AIA* AIJ* AJAH* AJCJ* AJF* AJG* AJJ* BAI* BBA* BBDE* BBG* BBI* BCC* BCD* BCFD* BDCE* BD...

result:

ok correct

Test #102:

score: 0
Accepted
time: 213ms
memory: 10848kb

input:

1000 100
ECNSLCKQCM JEHFECCSEC RIFNTEKGIA SLCKLSFJAC CHGCGBFIOK ISFGQDENGQ NHIALQNSDN MAAGNPMNKO SIPEDOGIGD TDITCLNJGR RMIMIRLBCA MIOHFDOEGQ LLLACCGDRK BSJAMFDETE STHBBGKDEF QHMGOERAPR RAKQHLCDMA PIEDTGLMIO TCNOHCARDD JSMRJMOHOP PCQGKELEOC IHAIFIFDCJ ENLEPKCBJR RITFQMTKJE KFBJOJAASS HIPQRRIFFQ FENNN...

output:

489376 376 AAA* ABA* ABM* ACT* AF* AGL* AHB* AHC* AIG* AIJT* AJC* AL* ANA* ANG* AP* AQL* AQN* ARG* ARJ* AT* BB* BEB* BF* BGD* BGL* BICA* BJL* BLF* BLO* BM* BQ* BRHF* BSP* CB* CCL* CCP* CE* CFI* CFM* CGK* CGQ* CHC* CHG* CIA* CIS* CKK* CQR* CSE* CSR* CT* DC* DD* DEN* DGB* DH* DIB* DMC* DMD* DMF* DNK* ...

result:

ok correct

Test #103:

score: 0
Accepted
time: 48ms
memory: 5620kb

input:

988 100
2Z- B9Y NKK K3G K5Z VF0 TQW UL5 5TI LFI LB3 Y3K T7R GGK S55 YTS 0OF U12 B2C 7T3 M0M 413 B9U YRM KWW FAU SGU 55X 7QZ DCV JJN UE1 H3L O4F 4S8 DMM SA9 1E8 H31 1V3 C7R C9U E31 NL5 23H 6IG 1QI YUZ GF3 LIB 734 FHD B23 M5K 6S5 G4E AUS HET 8R4 F4B 5DH WR2 ER7 56X AOT 8XT WVP SGT V7V TC- RD8 3DW ZOP ...

output:

511411 411 -1* -5* -64* -B* -F* -I* -M3* -U* -V* -X* 04* 06* 0A* 0C* 0H* 0J* 0N* 0OF* 0QS* 0R* 0U* 0W* 1-* 16C* 1J* 1P* 1S7* 1X* 24* 2O* 2Q* 2V* 2Z* 30* 3AE* 3DW* 3HV* 3L* 3M* 3T* 3UU* 3Y9* 41C* 422* 43* 44* 4D* 4IK* 4L* 4O* 4Q2* 4QS* 50* 59* 5A* 5B* 5G* 5MJ* 5Q* 5S* 5T* 5W* 5X* 5Z* 6--* 667* 6IG* 6...

result:

ok correct

Test #104:

score: 0
Accepted
time: 2ms
memory: 4168kb

input:

8 100
B5GHG VMYSO W5GHG R5GH1 R5GHJ XMYSD -MYSD VMYSA
8 1 7 2 3 6 8 5 4
2 1 6
8 7 8 5 6 2 4 1 3
2 8 5
7 7 1 6 4 5 8 3
7 8 5 6 2 3 7 4
2 5 4
6 4 8 6 7 1 5
6 3 5 6 4 7 1
8 4 5 2 3 7 8 6 1
0
0
6 3 7 6 5 4 8
0
3 1 6 5
2 6 3
7 1 3 4 6 5 8 2
0
1 6
5 5 1 3 2 7
8 4 5 2 6 8 3 7 1
8 8 7 4 6 2 5 3 1
4 1 8 4 2
...

output:

8001 1 *
2002 2 B* X*
8001 1 *
2002 2 R5GHJ* VMYSA*
7004 4 R* VMYSA* *D *G
7004 4 R* V* W* *D
2001 1 R*
6004 4 B* R* VMYSA* *D
6003 3 R* *D *G
8001 1 *
0 0
0 0
6004 4 R* VMYSA* W* *D
0 0
3003 3 B* R5GHJ* X*
2002 2 W* X*
7004 4 R* V* X* *G
0 0
1001 1 X*
5004 4 -* R5GHJ* VMYSO* *G
8001 1 *
8001 1 *
40...

result:

ok correct

Test #105:

score: 0
Accepted
time: 14ms
memory: 4504kb

input:

100 100
7YP5GHA 38ZITV9 0IT14GW R0HQ62W 7YP5GU9 CEZVHUX 39ZITP- NW8OQ1N Y-ZITV9 8C29D04 7YJ0TF3 0ONZMGV GA4KAY- ANV0JTJ 7F8OQ1M 3TTDDVU EHITSL8 1UOMHCX AG29DYG R0HQ6Q3 ZZHQ60X MX9J0VE M2AZQPZ ESWMLRD E6SP6SC ZJV0JE7 TEKG3IR ESWMLT9 J43DS2B NTITSL8 W2TDD2I ZJV0JG2 AK3PRU3 XMHPRVI JE2-BR2 -SHPRVI 314K...

output:

97033 33 0* 1* 2* 3* 5* 7F* 9* A* C4OMH6* CE* D* E* F* J* L* M* N* O* P* Q* R* T* W* X* Y* Z4* ZJ* *- *3 *4 *A *I *M
73036 36 0* 1U* 31* 39* 3T* 6* 7Y* 9* AG29DY* AM* C* DE* EA* F* I* L* M2* MX* NW* O6* P9* Q* R* S* T* W* XZHPR7* Y* ZF* ZJ* *0 *8 *9 *SC *VI *0X
43033 33 2H* 314KAT* 39ZITP* 3TTDDG* 4...

result:

ok correct

Test #106:

score: 0
Accepted
time: 49ms
memory: 5512kb

input:

966 100
D-J ULU LRS QTP 1J8 32G -P0 HGI 0BQ 2MG CVH -34 R1G M-N U64 MEN L4Z 0E1 -WC BTJ Y0F KE1 NMA 9L- NX7 UNC 1SL KJS 9VW TXM SB0 4YJ MGW 4TA RMI DKT XX0 12N G6E GNY IL- 8PT LWS ZTC ETQ WGW ZJ9 KP4 MJK ILN HGW 7NE N0S 4N6 T5D Z4Z 0FW WPT VXQ BMW E36 O2M 5B4 342 LUF OTC H2D OFD WLC QB0 LQ6 PGN JT2 ...

output:

589413 413 -2* -3* -5* -B* -G* -I* -KG* -PU* -V* 01O* 01P* 06* 07* 0BU* 0E-* 0E1* 0J* 0V5* 0Y* 100* 11G* 12* 1IN* 1J5* 1J8* 1KQ* 1M8* 1SL* 1U* 22Q* 25C* 25Z* 2H* 2MQ* 2Q* 32* 37Y* 3F* 3HX* 3IF* 3JQ* 3L* 3Q* 3R* 3X* 3ZW* 4-A* 41* 42* 453* 45P* 4G* 4K4* 4Q6* 4U* 5-* 50* 51* 52* 58* 5A* 5B3* 5H1* 5KN* ...

result:

ok correct

Test #107:

score: 0
Accepted
time: 134ms
memory: 8084kb

input:

1000 100
FZ0SPZ9 G3MHZIL 238D3G0 QYP4LBI LF9CC0A 9KK8BWH VO3KA2T 0272EZ8 8DU2LLB AAQGQIR -BMTS2U 5JA10-N 05KMNAR BSULLS5 ANTGWW5 QIP5XTC 2FGP-O1 3CFXLED 3-4REN9 ENDT914 5YJ9VOG 1CT-MW8 WXAPKFY 42E3DBO 2RWIVQY QL7IVG4 -S-5LE1 Z1EZL0F Q-R0TCQ 72LM5MG WMT-M8R 1P9J2RH R2VIMQI 9HUEX1Y 5GQ40L1 LV8F-UZ R2Z...

output:

66062 62 -36* 02VQ8T* 10* 1D* 1HJ* 1QGHK0* 24BST0* 26BEZN* 2JTPFB* 2W* 35K8B9* 3CFXLB* 49* 4ZF* 5GY* 7TR6* 86H* 88* 8EC1H9* 8L0* 97DXFJ* A8* AC5XTA* AIRE6H* AQ6U2-* AZ07GS* BYA* DRL93K* GGE220* HB5M2F* IOS2T8* JV5* LC* LG8VPQ* MD0CNB* OR72EX* P5* PHSME2* PTR0T0* QAZ9UU* QBEK* QR* RC* RH* RV0B9C* SI*...

result:

ok correct

Test #108:

score: 0
Accepted
time: 176ms
memory: 9544kb

input:

1000 100
XW42DVU4F SB5J4T44L ZRTETRUAY 1WV5YNL5W -KUVGVDTH 8-HHQABYU IICJUHWF- 2T4OIMA2P 3NWX1CC-0 SVA52M7VW GZ45ZQ7E9 WN1KD91TI Z1OSKWFNB D7T5BS2HM 4DLB87XBH UR0I2UM7H G3UHUA-PP PNS2HPW8O LU5GHYF8E J5KB7U71P D6JC2SE0L QK41JIW00 L43LU9AAP ORZ-Z4-3A 3DPM2LZB2 V5WC2SVZI UY18ISCMR 28EP3OX9T QJZZOWW4L Y...

output:

74072 72 00R4EAC* 05JD56K* 0L6* 0OGKHH1* 1LQ* 1U* 2Z* 3Q2BRL6* 3YE* 59PDYYM* 5F* 5J* 5O* 6RHX8G0* 7E0* 7J* 8KTU33S* 8P-* 8T41JI3* 9R71NYI* AEF* AN* CVNI6PX* D0FM2L2* D2PNRFJ* DAW* DH* E3QNJDL* EEB* FFJ* FTCCUR6* G8BGB3Q* GXR* HDY* I-E57N2* IE* IGJTHXD* IUYETR9* JN* KD6U192* KQ9R2G3* KTOU3EZ* L43LU9A...

result:

ok correct

Test #109:

score: 0
Accepted
time: 175ms
memory: 10012kb

input:

1000 100
712P8A2FAM 09H9-JYTOM B64-WIOPAP RSWNYLZZ6K KIG1X2R5D6 AT-FY48HMX K6ZP0YUOR2 AAZEOD8CMZ AEFJY2OJGF PUQ4PX2YG6 13JJMPGBBN E5A9EKZNEE LJOJOVSS7P 46T06QZ49T 2331TV7FCO 39OL9-ILP5 UZF7BVAY2H 2QHPVSYGLF 6SN2FG2OME IU7YWZ9GC3 9ETXQ4QB0I 88X1VKR9T3 L0QZOLR4EZ 7YZWR424MV AHXGIXM5OU TZR-KCO7AI KNGCS...

output:

649411 411 -6* -J* -M* -P* -ROM70C0* -W* -YC6T825* 07L2QUM7* 09* 0BK* 0EJZOLR2* 0I* 0KHMMSR9* 0MMV9XSG* 0MZAX892* 0PT* 0V* 0X7M7U8G* 11* 12* 13JJMPGT* 19* 1B* 1E* 1F* 1G7JWXEU* 1TZQY5RX* 1W* 1Z2* 21* 28C* 2D* 2I* 2Q* 2R* 2T* 3-* 30B5M9OO* 35* 39O* 3D* 3G* 3HOLO5XB* 3N* 3RYO* 3WP* 4-* 42* 44N* 49* 4A...

result:

ok correct

Test #110:

score: 0
Accepted
time: 2ms
memory: 4204kb

input:

7 100
YDIUW0CI0C YKRVY9W9UY CXWNQYCTNY Y5H9AMVTQY 6GY0UTDYDK 4E-AOS3BQY YGMIQP9RJG
4 6 7 5 2
2 7 3
5 2 1 4 6 7
6 1 7 6 3 5 4
3 4 5 2
6 2 5 6 7 3 1
1 7
2 5 4
2 6 1
0
5 7 5 2 1 4
1 2
1 3
3 4 7 5
0
0
6 7 5 1 6 4 3
3 2 5 4
1 1
2 5 3
4 7 4 3 6
3 7 3 2
6 2 3 4 7 1 6
7 1 7 4 6 3 5 2
2 1 3
5 4 6 1 5 2
4 3 1...

output:

4004 4 4* 6* YG* YK*
2002 2 C* YG*
5002 2 4* Y*
6005 5 6* C* YD* YG* *QY
3003 3 6* Y5* YK*
6006 6 4* 6* C* YD* YG* YK*
1001 1 YG*
2002 2 6* Y5*
2002 2 4* YD*
0 0
5002 2 6* Y*
1001 1 YK*
1001 1 C*
3003 3 6* Y5* YG*
0 0
0 0
6005 5 6* C* YD* YG* *QY
3003 3 6* Y5* YK*
1001 1 YD*
2002 2 6* C*
4003 3 C* Y...

result:

ok correct

Test #111:

score: 0
Accepted
time: 6ms
memory: 4460kb

input:

41 100
V457JG9HW2 G47YX6MZM9 -Y9B0RBO-R 9IXFEC9OPZ FY8NMG70RI WFV1PZQJZK 95QL0GGXHH 7E6W550I27 OVOP4FRQGI K3EHYQSX44 GUT6VPQ0U6 0ZW1DOTBB3 8H-O0XN25K 94T6OMB5D9 JJ3DRJULO- 7TBEPXLFX9 -5EJE1OOIS 75NV774CV4 JNWE-LHDCV YPEU3O9NSF UDJ9JHW1CK ANLA3AA5SZ R49WPX9BNV VOXEXGTN1- KBF96IZBUR JCYUZEUCV4 DGSH3UY...

output:

16016 16 -7* -P* -Y* 08* 75* 94* A* GU* GV* I* K3* KQR* T* U* W* Y*
37018 18 -5* -7* -M* -P* 0* 7* 9* A* D* G* JC* K* T* V* Y* *I *K *V
22016 16 -7* -M* 0E* 9* GL* GU* GV* JJ* KQ* T* VO* W* Y* *7 *I *R
23021 21 -7* -M* -P* 0Z* 75* 8H* D* G4* GU* JJ* JN* K3* KB* O* R* U* V4* W* Y* *7 *S
6005 5 -Y* 0Z...

result:

ok correct

Test #112:

score: 0
Accepted
time: 159ms
memory: 9528kb

input:

802 100
66NUVUSI3X UXJ2YC8BUX -1P28XWYOX 8E7SC98B6X -IUN4JWIFX AS6B37EV-X RX48RJ8754 83CZAB5PUX IVFYVKY7XX AFQXK1UBWX LB2PMW-IYX MFLPGASYOX N3CKSBCEAX DTCQMEKD8X Q3HN1S453X 4IO46G4TGX K22YHJUMF4 GK3FKYJJ1X 5495G5ORGX GDZFX3FQXX TR8-UYG52X 0C1DNGA1DX 2CLMQI73FX GKM-I2MMVX D46EV-41PX 5UCH6UQ5-X 0HYFCA...

output:

460366 366 -0* -1* -3* -4* -7D* -B* -D* -E* -G* -IC* -J* -K* -N* -P* -R* -V* -X* 01* 02* 08* 0C* 0D* 0E* 0F* 0HD* 0K* 0X* 20* 21* 222* 25* 2A* 2C* 2DI* 2K* 2N* 2S* 2V* 3-* 31* 37Q* 38* 3F* 3I* 3L* 3R* 3V* 4-* 42* 466* 48* 4D* 4E* 4H* 4IR* 4P* 4Q* 4U* 4Z* 5-9* 55* 5EO9* 5F* 5NV* 5O* 5Q* 5S9* 5U* 61* ...

result:

ok correct

Test #113:

score: 0
Accepted
time: 21ms
memory: 4824kb

input:

103 100
95XDA92N7U FOAVHUFZHU 04LTPWAYJL 9KWSIR0GY7 FVLK9X-4L7 087QW2O-DL F54H2VQYRL F4VY6CVW6L 0EV7UJ-PIU 9AEY353TIL FZX8O3YK97 9EQRL2PVWL FQLRGD58ML F-J6L2CMWU 0CE9TP4TEU 90HFRCV227 9RRP5X0QFU 0H1L9HYG8U 0R1S47HXR7 0IQBBGFF0U 0BQ-WQ3LS7 96W0XLKHB7 98WO2SS5YL 04BD1T8QF7 91HPAQI-HU FNOL8M9AMU FCZJHC...

output:

90060 60 00* 01* 02* 03* 04* 05* 06* 0AN* 0AS* 0B* 0C* 0E* 0G* 0H* 0I* 0J* 0K* 0Q* 0R* 0W* 0Y* 90* 91* 95* 98C* 98Y* 9AE* 9B* 9E* 9G* 9K* 9O* 9Y* F-* F2* F4* F5* F6* FC* FD* FGP* FJ* FL* FN* FOB* FOM* FP* FQ* FU* FVK* FY* *17 *57 *97 *A7 *B7 *S7 *DL *5U *6U
8008 8 0-* 05* 0GW* 0Y* 91* 9AE* F7* FJ5*
...

result:

ok correct