QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#505647#701. Proofsxiaowuc1AC ✓495ms30136kbPython3408b2024-08-05 06:36:322024-08-05 06:36:34

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 10592kb

input:

3
-> ALICE
-> BOB
ALICE BOB -> CARL

output:

correct

result:

ok single line: 'correct'

Test #2:

score: 0
Accepted
time: 15ms
memory: 10592kb

input:

1
A -> B

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 495ms
memory: 30028kb

input:

400000
-> KKGA
KKGA -> KKGA
KKGA -> KKGA
KKGA KKGA KKGA KKGA -> KKGA
KKGA KKGA KKGA KKGA KKGA -> NLWS
NLWS NLWS KKGA KKGA KKGA -> NZXM
KKGA NLWS KKGA KKGA -> FIWQ
NLWS NLWS NZXM -> SFYF
NZXM NLWS FIWQ FIWQ -> NLWS
-> XIZH
FIWQ NLWS FIWQ FIWQ -> PPBD
PPBD XIZH -> NLWS
PPBD -> CMAW
SFYF PPBD XIZH NLWS...

output:

correct

result:

ok single line: 'correct'

Test #4:

score: 0
Accepted
time: 206ms
memory: 20388kb

input:

400000
-> KKGA
KKGA -> KKGA
KKGA -> KKGA
KKGA KKGA KKGA KKGA -> KKGA
KKGA KKGA KKGA KKGA KKGA -> NLWS
NLWS NLWS KKGA KKGA KKGA -> NZXM
KKGA NLWS KKGA KKGA -> FIWQ
NLWS NLWS NZXM -> SFYF
NZXM NLWS FIWQ FIWQ -> NLWS
-> XIZH
FIWQ NLWS FIWQ FIWQ -> PPBD
PPBD XIZH -> NLWS
PPBD -> CMAW
SFYF PPBD XIZH NLWS...

output:

180688

result:

ok single line: '180688'

Test #5:

score: 0
Accepted
time: 441ms
memory: 30104kb

input:

400000
-> HNHI
HNHI HNHI HNHI HNHI HNHI -> HNHI
HNHI HNHI HNHI HNHI HNHI -> IION
-> HNHI
IION HNHI IION HNHI -> IION
HNHI HNHI IION HNHI -> KQZH
-> KQZH
-> HNHI
KQZH IION HNHI IION -> IION
IION HNHI IION KQZH IION -> IION
HNHI KQZH -> HNHI
KQZH IION KQZH HNHI IION -> IION
-> KZHK
HNHI KQZH -> TFUO
T...

output:

correct

result:

ok single line: 'correct'

Test #6:

score: 0
Accepted
time: 344ms
memory: 21464kb

input:

400000
-> HNHI
HNHI HNHI HNHI HNHI HNHI -> HNHI
HNHI HNHI HNHI HNHI HNHI -> IION
-> HNHI
IION HNHI IION HNHI -> IION
HNHI HNHI IION HNHI -> KQZH
-> KQZH
-> HNHI
KQZH IION HNHI IION -> IION
IION HNHI IION KQZH IION -> IION
HNHI KQZH -> HNHI
KQZH IION KQZH HNHI IION -> IION
-> KZHK
HNHI KQZH -> TFUO
T...

output:

301169

result:

ok single line: '301169'

Test #7:

score: 0
Accepted
time: 452ms
memory: 30120kb

input:

400000
-> VDAG
VDAG -> GSRD
VDAG VDAG GSRD GSRD -> GSRD
VDAG GSRD -> SHIG
-> SHIG
GSRD SHIG SHIG SHIG VDAG -> GSRD
-> EBSR
SHIG -> VDAG
SHIG -> GSRD
GSRD -> EBSR
EBSR SHIG -> EBSR
VDAG GSRD -> GSRD
-> GSRD
SHIG -> VDAG
EBSR -> EBSR
EBSR -> DGII
SHIG GSRD SHIG DGII VDAG -> REJI
DGII EBSR -> VDAG
EBSR...

output:

correct

result:

ok single line: 'correct'

Test #8:

score: 0
Accepted
time: 295ms
memory: 21060kb

input:

400000
-> VDAG
VDAG -> GSRD
VDAG VDAG GSRD GSRD -> GSRD
VDAG GSRD -> SHIG
-> SHIG
GSRD SHIG SHIG SHIG VDAG -> GSRD
-> EBSR
SHIG -> VDAG
SHIG -> GSRD
GSRD -> EBSR
EBSR SHIG -> EBSR
VDAG GSRD -> GSRD
-> GSRD
SHIG -> VDAG
EBSR -> EBSR
EBSR -> DGII
SHIG GSRD SHIG DGII VDAG -> REJI
DGII EBSR -> VDAG
EBSR...

output:

274765

result:

ok single line: '274765'

Test #9:

score: 0
Accepted
time: 454ms
memory: 30044kb

input:

400000
-> GWWX
GWWX GWWX GWWX -> QWMD
QWMD QWMD QWMD -> GWWX
QWMD QWMD GWWX QWMD QWMD -> EUAO
GWWX GWWX EUAO QWMD GWWX -> EUAO
QWMD EUAO QWMD -> EUAO
QWMD EUAO -> EUAO
EUAO GWWX QWMD EUAO -> GWWX
EUAO GWWX EUAO GWWX GWWX -> TCQG
TCQG GWWX EUAO -> HFUK
-> EHFO
HFUK QWMD -> EUAO
TCQG -> YGAX
TCQG -> G...

output:

correct

result:

ok single line: 'correct'

Test #10:

score: 0
Accepted
time: 187ms
memory: 20420kb

input:

400000
-> GWWX
GWWX GWWX GWWX -> QWMD
QWMD QWMD QWMD -> GWWX
QWMD QWMD GWWX QWMD QWMD -> EUAO
GWWX GWWX EUAO QWMD GWWX -> EUAO
QWMD EUAO QWMD -> EUAO
QWMD EUAO -> EUAO
EUAO GWWX QWMD EUAO -> GWWX
EUAO GWWX EUAO GWWX GWWX -> TCQG
TCQG GWWX EUAO -> HFUK
-> EHFO
HFUK QWMD -> EUAO
TCQG -> YGAX
TCQG -> G...

output:

168851

result:

ok single line: '168851'

Test #11:

score: 0
Accepted
time: 476ms
memory: 30136kb

input:

400000
-> THGK
THGK THGK THGK THGK -> THGK
THGK THGK THGK THGK THGK -> THGK
THGK THGK THGK -> GHIE
GHIE THGK THGK THGK GHIE -> GHIE
THGK THGK -> GKRV
GKRV GKRV GHIE GHIE GHIE -> OLHE
-> YDOI
GKRV -> HMJI
OLHE GHIE HMJI YDOI -> HDIS
OLHE THGK HMJI HMJI GHIE -> FGQU
OLHE FGQU GKRV -> QAHU
OLHE -> GHIE...

output:

correct

result:

ok single line: 'correct'

Test #12:

score: 0
Accepted
time: 107ms
memory: 14888kb

input:

400000
-> THGK
THGK THGK THGK THGK -> THGK
THGK THGK THGK THGK THGK -> THGK
THGK THGK THGK -> GHIE
GHIE THGK THGK THGK GHIE -> GHIE
THGK THGK -> GKRV
GKRV GKRV GHIE GHIE GHIE -> OLHE
-> YDOI
GKRV -> HMJI
OLHE GHIE HMJI YDOI -> HDIS
OLHE THGK HMJI HMJI GHIE -> FGQU
OLHE FGQU GKRV -> QAHU
OLHE -> GHIE...

output:

96103

result:

ok single line: '96103'

Test #13:

score: 0
Accepted
time: 53ms
memory: 13956kb

input:

40000
-> NSBU
NSBU NSBU -> NSBU
NSBU -> NSBU
NSBU -> NSBU
NSBU NSBU NSBU NSBU NSBU -> NSBU
NSBU NSBU NSBU NSBU NSBU -> NSBU
-> JSMD
JSMD NSBU JSMD -> JSMD
JSMD NSBU NSBU NSBU -> LFWS
-> IZXW
-> LFWS
LFWS IZXW LFWS -> TKZF
NSBU -> WKRJ
-> QZMN
IZXW NSBU LFWS LFWS -> GGUB
QZMN LFWS -> QHKA
-> NSBU
QZM...

output:

correct

result:

ok single line: 'correct'

Test #14:

score: 0
Accepted
time: 23ms
memory: 11384kb

input:

40000
-> NSBU
NSBU NSBU -> NSBU
NSBU -> NSBU
NSBU -> NSBU
NSBU NSBU NSBU NSBU NSBU -> NSBU
NSBU NSBU NSBU NSBU NSBU -> NSBU
-> JSMD
JSMD NSBU JSMD -> JSMD
JSMD NSBU NSBU NSBU -> LFWS
-> IZXW
-> LFWS
LFWS IZXW LFWS -> TKZF
NSBU -> WKRJ
-> QZMN
IZXW NSBU LFWS LFWS -> GGUB
QZMN LFWS -> QHKA
-> NSBU
QZM...

output:

19455

result:

ok single line: '19455'

Test #15:

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

input:

40000
-> ILLY
ILLY ILLY -> MMVI
ILLY ILLY ILLY -> LQWF
LQWF LQWF MMVI LQWF -> ZNDO
LQWF ILLY LQWF MMVI -> DECK
MMVI DECK DECK -> UKGG
ILLY -> GHIB
LQWF MMVI LQWF ZNDO -> LQWF
-> XOLZ
XOLZ LQWF ILLY -> LQWF
DECK GHIB ILLY -> CJLS
DECK -> XOLZ
UKGG DECK XOLZ LQWF -> RUDF
RUDF XOLZ LQWF MMVI UKGG -> EY...

output:

correct

result:

ok single line: 'correct'

Test #16:

score: 0
Accepted
time: 20ms
memory: 11352kb

input:

40000
-> ILLY
ILLY ILLY -> MMVI
ILLY ILLY ILLY -> LQWF
LQWF LQWF MMVI LQWF -> ZNDO
LQWF ILLY LQWF MMVI -> DECK
MMVI DECK DECK -> UKGG
ILLY -> GHIB
LQWF MMVI LQWF ZNDO -> LQWF
-> XOLZ
XOLZ LQWF ILLY -> LQWF
DECK GHIB ILLY -> CJLS
DECK -> XOLZ
UKGG DECK XOLZ LQWF -> RUDF
RUDF XOLZ LQWF MMVI UKGG -> EY...

output:

13109

result:

ok single line: '13109'

Test #17:

score: 0
Accepted
time: 42ms
memory: 13920kb

input:

40000
-> UFRY
-> CWDN
CWDN -> UFRY
CWDN UFRY UFRY CWDN CWDN -> GAUH
GAUH GAUH -> GAUH
CWDN CWDN GAUH -> BEFK
UFRY CWDN -> BEFK
BEFK UFRY -> GAUH
UFRY GAUH BEFK -> VNQF
CWDN UFRY -> IHWC
CWDN GAUH CWDN -> KHNQ
BEFK -> KHNQ
UFRY CWDN UFRY KHNQ VNQF -> IHWC
GAUH KHNQ KHNQ BEFK -> XJEU
UFRY UFRY -> UFRY...

output:

correct

result:

ok single line: 'correct'

Test #18:

score: 0
Accepted
time: 28ms
memory: 11364kb

input:

40000
-> UFRY
-> CWDN
CWDN -> UFRY
CWDN UFRY UFRY CWDN CWDN -> GAUH
GAUH GAUH -> GAUH
CWDN CWDN GAUH -> BEFK
UFRY CWDN -> BEFK
BEFK UFRY -> GAUH
UFRY GAUH BEFK -> VNQF
CWDN UFRY -> IHWC
CWDN GAUH CWDN -> KHNQ
BEFK -> KHNQ
UFRY CWDN UFRY KHNQ VNQF -> IHWC
GAUH KHNQ KHNQ BEFK -> XJEU
UFRY UFRY -> UFRY...

output:

16323

result:

ok single line: '16323'

Test #19:

score: 0
Accepted
time: 47ms
memory: 14044kb

input:

40000
-> CYSA
CYSA CYSA -> OVAU
CYSA CYSA OVAU OVAU CYSA -> ZGCU
CYSA -> CAMA
CAMA CAMA CAMA CYSA -> ZEUY
CYSA CYSA ZEUY -> OVAU
ZEUY -> CAMA
CAMA ZEUY CYSA CYSA -> BTJU
CAMA -> HECU
BTJU ZEUY HECU -> HECU
ZGCU CYSA BTJU -> DAIU
-> BTJU
CYSA BTJU DAIU -> CAMA
-> DAIU
ZEUY ZEUY CAMA ZGCU -> NGVN
-> Y...

output:

correct

result:

ok single line: 'correct'

Test #20:

score: 0
Accepted
time: 31ms
memory: 11668kb

input:

40000
-> CYSA
CYSA CYSA -> OVAU
CYSA CYSA OVAU OVAU CYSA -> ZGCU
CYSA -> CAMA
CAMA CAMA CAMA CYSA -> ZEUY
CYSA CYSA ZEUY -> OVAU
ZEUY -> CAMA
CAMA ZEUY CYSA CYSA -> BTJU
CAMA -> HECU
BTJU ZEUY HECU -> HECU
ZGCU CYSA BTJU -> DAIU
-> BTJU
CYSA BTJU DAIU -> CAMA
-> DAIU
ZEUY ZEUY CAMA ZGCU -> NGVN
-> Y...

output:

23339

result:

ok single line: '23339'

Test #21:

score: 0
Accepted
time: 50ms
memory: 13928kb

input:

40000
-> NIRZ
NIRZ NIRZ NIRZ NIRZ NIRZ -> TIKT
NIRZ TIKT TIKT NIRZ -> MNIW
TIKT NIRZ MNIW TIKT MNIW -> KGPX
NIRZ TIKT NIRZ NIRZ TIKT -> HRPC
NIRZ TIKT -> KGPX
-> KGPX
TIKT HRPC KGPX KGPX -> ZZXV
-> ADOT
-> WMJP
ZZXV -> ZEZS
ZEZS MNIW MNIW MNIW ADOT -> KGPX
ZZXV HRPC -> WMJP
MNIW ZEZS ZEZS NIRZ TIKT ...

output:

correct

result:

ok single line: 'correct'

Test #22:

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

input:

40000
-> NIRZ
NIRZ NIRZ NIRZ NIRZ NIRZ -> TIKT
NIRZ TIKT TIKT NIRZ -> MNIW
TIKT NIRZ MNIW TIKT MNIW -> KGPX
NIRZ TIKT NIRZ NIRZ TIKT -> HRPC
NIRZ TIKT -> KGPX
-> KGPX
TIKT HRPC KGPX KGPX -> ZZXV
-> ADOT
-> WMJP
ZZXV -> ZEZS
ZEZS MNIW MNIW MNIW ADOT -> KGPX
ZZXV HRPC -> WMJP
MNIW ZEZS ZEZS NIRZ TIKT ...

output:

23610

result:

ok single line: '23610'

Test #23:

score: 0
Accepted
time: 47ms
memory: 14032kb

input:

40000
-> WJQI
WJQI WJQI WJQI WJQI -> YGUW
YGUW YGUW WJQI WJQI -> RIYY
YGUW RIYY RIYY YGUW WJQI -> MYGE
MYGE WJQI -> MYGE
MYGE YGUW RIYY -> WJQI
WJQI RIYY -> QNSA
YGUW RIYY WJQI WJQI MYGE -> RIYY
QNSA -> RLFM
RLFM MYGE -> RIYY
WJQI -> RIYY
RLFM RLFM RLFM -> YMDN
WJQI YMDN RLFM -> JTFU
JTFU WJQI RIYY ...

output:

correct

result:

ok single line: 'correct'

Test #24:

score: 0
Accepted
time: 35ms
memory: 11472kb

input:

40000
-> WJQI
WJQI WJQI WJQI WJQI -> YGUW
YGUW YGUW WJQI WJQI -> RIYY
YGUW RIYY RIYY YGUW WJQI -> MYGE
MYGE WJQI -> MYGE
MYGE YGUW RIYY -> WJQI
WJQI RIYY -> QNSA
YGUW RIYY WJQI WJQI MYGE -> RIYY
QNSA -> RLFM
RLFM MYGE -> RIYY
WJQI -> RIYY
RLFM RLFM RLFM -> YMDN
WJQI YMDN RLFM -> JTFU
JTFU WJQI RIYY ...

output:

19344

result:

ok single line: '19344'

Test #25:

score: 0
Accepted
time: 50ms
memory: 13948kb

input:

40000
-> OLJT
OLJT OLJT OLJT OLJT -> PSHS
PSHS OLJT PSHS -> KBSL
OLJT OLJT KBSL KBSL OLJT -> DHIQ
KBSL -> LBOD
OLJT PSHS DHIQ OLJT KBSL -> KBSL
LBOD OLJT PSHS -> ASPF
-> KBSL
OLJT LBOD DHIQ LBOD OLJT -> ASPF
OLJT LBOD -> DHIQ
LBOD LBOD ASPF OLJT PSHS -> LBOD
LBOD PSHS DHIQ ASPF -> DIIC
LBOD OLJT -> ...

output:

correct

result:

ok single line: 'correct'

Test #26:

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

input:

40000
-> OLJT
OLJT OLJT OLJT OLJT -> PSHS
PSHS OLJT PSHS -> KBSL
OLJT OLJT KBSL KBSL OLJT -> DHIQ
KBSL -> LBOD
OLJT PSHS DHIQ OLJT KBSL -> KBSL
LBOD OLJT PSHS -> ASPF
-> KBSL
OLJT LBOD DHIQ LBOD OLJT -> ASPF
OLJT LBOD -> DHIQ
LBOD LBOD ASPF OLJT PSHS -> LBOD
LBOD PSHS DHIQ ASPF -> DIIC
LBOD OLJT -> ...

output:

18082

result:

ok single line: '18082'

Test #27:

score: 0
Accepted
time: 47ms
memory: 13956kb

input:

40000
-> QRFJ
QRFJ QRFJ QRFJ QRFJ -> QRFJ
QRFJ QRFJ -> PZFC
QRFJ PZFC QRFJ PZFC PZFC -> TXYC
-> TXYC
QRFJ TXYC -> PZFC
TXYC PZFC QRFJ QRFJ -> RRKG
-> EVIJ
PZFC -> EHGG
QRFJ EVIJ EVIJ -> AGBX
AGBX -> TXYC
-> LIXO
-> EVIJ
LIXO EVIJ EVIJ LIXO LIXO -> TXYC
EVIJ AGBX RRKG EHGG EHGG -> LIXO
TXYC EHGG AGBX...

output:

correct

result:

ok single line: 'correct'

Test #28:

score: 0
Accepted
time: 38ms
memory: 11580kb

input:

40000
-> QRFJ
QRFJ QRFJ QRFJ QRFJ -> QRFJ
QRFJ QRFJ -> PZFC
QRFJ PZFC QRFJ PZFC PZFC -> TXYC
-> TXYC
QRFJ TXYC -> PZFC
TXYC PZFC QRFJ QRFJ -> RRKG
-> EVIJ
PZFC -> EHGG
QRFJ EVIJ EVIJ -> AGBX
AGBX -> TXYC
-> LIXO
-> EVIJ
LIXO EVIJ EVIJ LIXO LIXO -> TXYC
EVIJ AGBX RRKG EHGG EHGG -> LIXO
TXYC EHGG AGBX...

output:

31138

result:

ok single line: '31138'

Test #29:

score: 0
Accepted
time: 57ms
memory: 13956kb

input:

40000
-> DRUV
DRUV DRUV -> BIYM
DRUV DRUV DRUV BIYM DRUV -> DRUV
-> KHFC
DRUV KHFC BIYM -> EMZL
EMZL -> KHFC
BIYM BIYM BIYM DRUV KHFC -> XXJM
-> EMZL
DRUV BIYM XXJM -> EMZL
DRUV -> VGTO
EMZL BIYM VGTO KHFC -> BIYM
XXJM KHFC -> XWOK
EMZL XWOK EMZL -> TKLR
BIYM -> VGTO
BIYM BIYM BIYM BIYM BIYM -> UUCJ...

output:

correct

result:

ok single line: 'correct'

Test #30:

score: 0
Accepted
time: 10ms
memory: 10740kb

input:

40000
-> DRUV
DRUV DRUV -> BIYM
DRUV DRUV DRUV BIYM DRUV -> DRUV
-> KHFC
DRUV KHFC BIYM -> EMZL
EMZL -> KHFC
BIYM BIYM BIYM DRUV KHFC -> XXJM
-> EMZL
DRUV BIYM XXJM -> EMZL
DRUV -> VGTO
EMZL BIYM VGTO KHFC -> BIYM
XXJM KHFC -> XWOK
EMZL XWOK EMZL -> TKLR
BIYM -> VGTO
BIYM BIYM BIYM BIYM BIYM -> UUCJ...

output:

2525

result:

ok single line: '2525'

Test #31:

score: 0
Accepted
time: 57ms
memory: 14032kb

input:

40000
-> UHYH
UHYH UHYH UHYH UHYH UHYH -> EMMQ
EMMQ UHYH -> UYBG
UYBG UHYH EMMQ UYBG -> UHYH
UYBG UHYH UYBG UHYH UYBG -> EMMQ
EMMQ UHYH UYBG EMMQ -> EMMQ
EMMQ UYBG UHYH -> UURB
UHYH UHYH -> QOKB
-> UYBG
UYBG UHYH EMMQ UHYH UYBG -> EMMQ
QOKB QOKB EMMQ EMMQ -> UYBG
UYBG UYBG QOKB UURB QOKB -> QOKB
QOK...

output:

correct

result:

ok single line: 'correct'

Test #32:

score: 0
Accepted
time: 23ms
memory: 11368kb

input:

40000
-> UHYH
UHYH UHYH UHYH UHYH UHYH -> EMMQ
EMMQ UHYH -> UYBG
UYBG UHYH EMMQ UYBG -> UHYH
UYBG UHYH UYBG UHYH UYBG -> EMMQ
EMMQ UHYH UYBG EMMQ -> EMMQ
EMMQ UYBG UHYH -> UURB
UHYH UHYH -> QOKB
-> UYBG
UYBG UHYH EMMQ UHYH UYBG -> EMMQ
QOKB QOKB EMMQ EMMQ -> UYBG
UYBG UYBG QOKB UURB QOKB -> QOKB
QOK...

output:

10551

result:

ok single line: '10551'

Test #33:

score: 0
Accepted
time: 52ms
memory: 14044kb

input:

40000
-> EBTP
EBTP EBTP EBTP EBTP -> EBTP
EBTP EBTP EBTP EBTP -> PSJM
-> EBTP
PSJM -> XBVF
PSJM XBVF -> PSJM
EBTP EBTP -> IXAI
-> SSXB
IXAI EBTP SSXB -> XBVF
-> PSJM
XBVF IXAI XBVF IXAI EBTP -> ITRW
SSXB XBVF ITRW EBTP -> SSXB
SSXB EBTP -> RUPS
EBTP EBTP -> ZXSK
SSXB XBVF -> PSJM
PSJM RUPS EBTP XBVF...

output:

correct

result:

ok single line: 'correct'

Test #34:

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

input:

40000
-> EBTP
EBTP EBTP EBTP EBTP -> EBTP
EBTP EBTP EBTP EBTP -> PSJM
-> EBTP
PSJM -> XBVF
PSJM XBVF -> PSJM
EBTP EBTP -> IXAI
-> SSXB
IXAI EBTP SSXB -> XBVF
-> PSJM
XBVF IXAI XBVF IXAI EBTP -> ITRW
SSXB XBVF ITRW EBTP -> SSXB
SSXB EBTP -> RUPS
EBTP EBTP -> ZXSK
SSXB XBVF -> PSJM
PSJM RUPS EBTP XBVF...

output:

25300

result:

ok single line: '25300'

Test #35:

score: 0
Accepted
time: 41ms
memory: 13936kb

input:

40000
-> KODI
-> KODI
-> TPCA
TPCA KODI KODI TPCA KODI -> JBPS
TPCA TPCA JBPS KODI TPCA -> JBPS
JBPS KODI JBPS KODI JBPS -> DEOB
DEOB KODI JBPS -> KODI
DEOB KODI TPCA -> XTJY
TPCA -> CYWD
CYWD -> JBPS
JBPS TPCA TPCA CYWD -> ZPYK
CYWD DEOB KODI DEOB TPCA -> YQQH
KODI ZPYK -> HRAI
XTJY -> ZPYK
HRAI KO...

output:

correct

result:

ok single line: 'correct'

Test #36:

score: 0
Accepted
time: 12ms
memory: 10800kb

input:

40000
-> KODI
-> KODI
-> TPCA
TPCA KODI KODI TPCA KODI -> JBPS
TPCA TPCA JBPS KODI TPCA -> JBPS
JBPS KODI JBPS KODI JBPS -> DEOB
DEOB KODI JBPS -> KODI
DEOB KODI TPCA -> XTJY
TPCA -> CYWD
CYWD -> JBPS
JBPS TPCA TPCA CYWD -> ZPYK
CYWD DEOB KODI DEOB TPCA -> YQQH
KODI ZPYK -> HRAI
XTJY -> ZPYK
HRAI KO...

output:

1411

result:

ok single line: '1411'

Test #37:

score: 0
Accepted
time: 38ms
memory: 13924kb

input:

40000
-> WBKE
WBKE WBKE WBKE WBKE -> WBKE
WBKE WBKE WBKE WBKE -> MEZY
WBKE MEZY WBKE MEZY WBKE -> WBKE
-> NXXU
WBKE -> ZLGF
WBKE MEZY -> MEZY
ZLGF -> WHWE
WBKE NXXU -> AWJT
WBKE WBKE AWJT -> USRT
NXXU MEZY -> AWJT
NXXU NXXU -> ZLGF
-> NXXU
-> QGMM
NXXU -> QGMM
MEZY NXXU -> ZEBV
AWJT ZLGF -> YXZS
USR...

output:

correct

result:

ok single line: 'correct'

Test #38:

score: 0
Accepted
time: 33ms
memory: 11668kb

input:

40000
-> WBKE
WBKE WBKE WBKE WBKE -> WBKE
WBKE WBKE WBKE WBKE -> MEZY
WBKE MEZY WBKE MEZY WBKE -> WBKE
-> NXXU
WBKE -> ZLGF
WBKE MEZY -> MEZY
ZLGF -> WHWE
WBKE NXXU -> AWJT
WBKE WBKE AWJT -> USRT
NXXU MEZY -> AWJT
NXXU NXXU -> ZLGF
-> NXXU
-> QGMM
NXXU -> QGMM
MEZY NXXU -> ZEBV
AWJT ZLGF -> YXZS
USR...

output:

29723

result:

ok single line: '29723'

Test #39:

score: 0
Accepted
time: 57ms
memory: 13956kb

input:

40000
-> NGNX
NGNX -> WNNY
WNNY NGNX WNNY NGNX -> WNNY
NGNX NGNX WNNY WNNY NGNX -> SZRF
-> JRLG
SZRF JRLG JRLG -> DBAT
JRLG JRLG SZRF -> DBAT
NGNX SZRF SZRF -> IMBG
JRLG -> OLPY
NGNX IMBG DBAT IMBG -> WNNY
-> QUKX
IMBG SZRF IMBG SZRF JRLG -> IMBG
WNNY QUKX QUKX -> JRLG
JRLG QUKX NGNX -> DBAT
OLPY JR...

output:

correct

result:

ok single line: 'correct'

Test #40:

score: 0
Accepted
time: 22ms
memory: 10852kb

input:

40000
-> NGNX
NGNX -> WNNY
WNNY NGNX WNNY NGNX -> WNNY
NGNX NGNX WNNY WNNY NGNX -> SZRF
-> JRLG
SZRF JRLG JRLG -> DBAT
JRLG JRLG SZRF -> DBAT
NGNX SZRF SZRF -> IMBG
JRLG -> OLPY
NGNX IMBG DBAT IMBG -> WNNY
-> QUKX
IMBG SZRF IMBG SZRF JRLG -> IMBG
WNNY QUKX QUKX -> JRLG
JRLG QUKX NGNX -> DBAT
OLPY JR...

output:

6711

result:

ok single line: '6711'

Test #41:

score: 0
Accepted
time: 53ms
memory: 14016kb

input:

40000
-> PZVY
PZVY PZVY PZVY -> OMHV
OMHV OMHV PZVY OMHV OMHV -> QHWT
QHWT -> OMHV
PZVY OMHV QHWT -> OMHV
-> GAIX
QHWT PZVY PZVY PZVY GAIX -> TKUN
OMHV QHWT -> GAIX
GAIX TKUN PZVY GAIX -> TKUN
PZVY -> TKUN
OMHV QHWT -> OMHV
TKUN GAIX PZVY OMHV -> UHZM
OMHV -> OMHV
TKUN UHZM UHZM -> PZVY
PZVY GAIX GA...

output:

correct

result:

ok single line: 'correct'

Test #42:

score: 0
Accepted
time: 28ms
memory: 11376kb

input:

40000
-> PZVY
PZVY PZVY PZVY -> OMHV
OMHV OMHV PZVY OMHV OMHV -> QHWT
QHWT -> OMHV
PZVY OMHV QHWT -> OMHV
-> GAIX
QHWT PZVY PZVY PZVY GAIX -> TKUN
OMHV QHWT -> GAIX
GAIX TKUN PZVY GAIX -> TKUN
PZVY -> TKUN
OMHV QHWT -> OMHV
TKUN GAIX PZVY OMHV -> UHZM
OMHV -> OMHV
TKUN UHZM UHZM -> PZVY
PZVY GAIX GA...

output:

17129

result:

ok single line: '17129'

Test #43:

score: 0
Accepted
time: 39ms
memory: 13948kb

input:

40000
-> GKLL
GKLL GKLL GKLL GKLL -> GZGP
-> GZGP
GZGP GZGP GZGP GZGP GZGP -> PHHH
GZGP GKLL PHHH GKLL PHHH -> LBTV
GZGP LBTV LBTV GZGP LBTV -> PHHH
-> CQLH
PHHH CQLH LBTV -> DYLR
GZGP CQLH GZGP -> PHHH
PHHH -> HIEI
GZGP -> CVOD
GKLL -> DYLR
GKLL DYLR CQLH -> LWET
CVOD GKLL LBTV HIEI GKLL -> CPEF
PH...

output:

correct

result:

ok single line: 'correct'

Test #44:

score: 0
Accepted
time: 10ms
memory: 10532kb

input:

40000
-> GKLL
GKLL GKLL GKLL GKLL -> GZGP
-> GZGP
GZGP GZGP GZGP GZGP GZGP -> PHHH
GZGP GKLL PHHH GKLL PHHH -> LBTV
GZGP LBTV LBTV GZGP LBTV -> PHHH
-> CQLH
PHHH CQLH LBTV -> DYLR
GZGP CQLH GZGP -> PHHH
PHHH -> HIEI
GZGP -> CVOD
GKLL -> DYLR
GKLL DYLR CQLH -> LWET
CVOD GKLL LBTV HIEI GKLL -> CPEF
PH...

output:

495

result:

ok single line: '495'

Test #45:

score: 0
Accepted
time: 51ms
memory: 13952kb

input:

40000
-> APVY
APVY APVY APVY APVY -> APVY
APVY APVY APVY APVY -> APVY
APVY APVY APVY -> SPXX
APVY -> APVY
APVY SPXX -> LJZC
SPXX APVY LJZC -> GBWX
-> GBWX
LJZC GBWX GBWX -> PPVA
SPXX PPVA LJZC PPVA APVY -> TWYR
LJZC TWYR GBWX TWYR -> TWYR
LJZC APVY TWYR -> APVY
-> BVKU
SPXX PPVA BVKU PPVA APVY -> OW...

output:

correct

result:

ok single line: 'correct'

Test #46:

score: 0
Accepted
time: 29ms
memory: 11380kb

input:

40000
-> APVY
APVY APVY APVY APVY -> APVY
APVY APVY APVY APVY -> APVY
APVY APVY APVY -> SPXX
APVY -> APVY
APVY SPXX -> LJZC
SPXX APVY LJZC -> GBWX
-> GBWX
LJZC GBWX GBWX -> PPVA
SPXX PPVA LJZC PPVA APVY -> TWYR
LJZC TWYR GBWX TWYR -> TWYR
LJZC APVY TWYR -> APVY
-> BVKU
SPXX PPVA BVKU PPVA APVY -> OW...

output:

16814

result:

ok single line: '16814'

Test #47:

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

input:

40000
-> LATL
LATL LATL LATL LATL -> LATL
LATL LATL LATL LATL -> LATL
LATL LATL LATL -> LATL
LATL LATL LATL LATL -> LATL
LATL LATL -> BTPL
LATL LATL LATL BTPL LATL -> BTPL
BTPL BTPL -> LATL
-> QOWY
QOWY BTPL LATL LATL -> TZDX
QOWY QOWY -> OLGX
BTPL LATL OLGX TZDX -> QOWY
-> OLGX
BTPL OLGX LATL LATL ...

output:

correct

result:

ok single line: 'correct'

Test #48:

score: 0
Accepted
time: 13ms
memory: 10676kb

input:

40000
-> LATL
LATL LATL LATL LATL -> LATL
LATL LATL LATL LATL -> LATL
LATL LATL LATL -> LATL
LATL LATL LATL LATL -> LATL
LATL LATL -> BTPL
LATL LATL LATL BTPL LATL -> BTPL
BTPL BTPL -> LATL
-> QOWY
QOWY BTPL LATL LATL -> TZDX
QOWY QOWY -> OLGX
BTPL LATL OLGX TZDX -> QOWY
-> OLGX
BTPL OLGX LATL LATL ...

output:

3180

result:

ok single line: '3180'

Test #49:

score: 0
Accepted
time: 53ms
memory: 13948kb

input:

40000
-> NODD
NODD -> NODD
-> VRMH
VRMH NODD NODD NODD -> VRMH
VRMH -> AGRW
AGRW VRMH VRMH AGRW VRMH -> VRMH
VRMH NODD VRMH -> VRMH
AGRW AGRW NODD AGRW -> NODD
NODD VRMH VRMH VRMH AGRW -> AGRW
-> NODD
NODD NODD -> NODD
-> ZBQK
NODD AGRW -> NODD
AGRW NODD AGRW -> KQWD
ZBQK KQWD KQWD -> NODD
ZBQK VRMH...

output:

correct

result:

ok single line: 'correct'

Test #50:

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

input:

40000
-> NODD
NODD -> NODD
-> VRMH
VRMH NODD NODD NODD -> VRMH
VRMH -> AGRW
AGRW VRMH VRMH AGRW VRMH -> VRMH
VRMH NODD VRMH -> VRMH
AGRW AGRW NODD AGRW -> NODD
NODD VRMH VRMH VRMH AGRW -> AGRW
-> NODD
NODD NODD -> NODD
-> ZBQK
NODD AGRW -> NODD
AGRW NODD AGRW -> KQWD
ZBQK KQWD KQWD -> NODD
ZBQK VRMH...

output:

20872

result:

ok single line: '20872'

Test #51:

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

input:

40000
-> UMMH
UMMH UMMH UMMH -> UMMH
UMMH UMMH -> SITW
UMMH SITW SITW UMMH -> UMMH
UMMH SITW SITW UMMH SITW -> SITW
SITW SITW UMMH SITW SITW -> UMMH
SITW -> LLIB
LLIB SITW LLIB LLIB -> XWSS
SITW UMMH LLIB -> XWSS
-> SITW
XWSS -> CNDL
XWSS -> LLIB
CNDL CNDL UMMH UMMH -> AMQM
LLIB XWSS SITW UMMH -> LL...

output:

correct

result:

ok single line: 'correct'

Test #52:

score: 0
Accepted
time: 13ms
memory: 10700kb

input:

40000
-> UMMH
UMMH UMMH UMMH -> UMMH
UMMH UMMH -> SITW
UMMH SITW SITW UMMH -> UMMH
UMMH SITW SITW UMMH SITW -> SITW
SITW SITW UMMH SITW SITW -> UMMH
SITW -> LLIB
LLIB SITW LLIB LLIB -> XWSS
SITW UMMH LLIB -> XWSS
-> SITW
XWSS -> CNDL
XWSS -> LLIB
CNDL CNDL UMMH UMMH -> AMQM
LLIB XWSS SITW UMMH -> LL...

output:

1998

result:

ok single line: '1998'

Test #53:

score: 0
Accepted
time: 15ms
memory: 10704kb

input:

1
A -> A

output:

1

result:

ok single line: '1'

Test #54:

score: 0
Accepted
time: 7ms
memory: 10648kb

input:

2
A -> A
B -> A

output:

1

result:

ok single line: '1'

Test #55:

score: 0
Accepted
time: 15ms
memory: 10536kb

input:

3
-> A
-> B
A B -> A

output:

correct

result:

ok single line: 'correct'

Test #56:

score: 0
Accepted
time: 4ms
memory: 10592kb

input:

2
-> A
A A -> B

output:

correct

result:

ok single line: 'correct'