#!/usr/bin/env python3

import re

INPUT = '''
gbyvdfh (155) -> xqmnq, iyoqt, dimle
oweiea (97)
szhxrs (14)
pjvwsiw (23)
ycbok (193) -> xibkhsl, futjpq
wtqnsfh (32)
jyphghz (5573) -> tuxkm, gcprg, aabvhmt
fznumf (62)
kogwes (98)
sirhaf (57)
rhnaxsw (42)
kdqyfds (26)
tcklgm (62)
ijeid (142) -> ehjhf, xwdoa
tqtxfhm (1895) -> qpayfin, kecxvp, uoolai
gwdydcb (54)
npjfimt (99) -> qzyvb, dzewqbg, gvsuwlg, gjobtb
qapbaz (645) -> gyvdr, qdywe, mrgsrr, oeyouc
ikplxqu (2287) -> grlhmxk, fgspffp, cqfxi
jczdsk (188) -> gofnx, xvybzq
mrovove (51)
giyxwy (83)
bydzvyp (16)
itfdh (309) -> oyhly, kshpdif
pxmnf (256) -> dzqjyp, newtdcb
xwdoa (89)
iekxhkq (8)
mumya (92) -> pqzpiv, uxvcxh
papkps (57)
vmuqhd (53)
ufeocln (239) -> airdbn, xzdshuy, mizef
mwurel (40)
unxmdz (93)
tplns (47)
gmlan (93) -> waxhr, soplysp
ntnsu (90)
bitieb (23)
alfjsh (1091) -> rgzaw, kusypo, hudcat
rrpfg (37)
lpvfr (93) -> vipnwr, emyhta
dpzkyyl (61)
insblu (75) -> ftcnd, ubjywkt, clmenxm
lryqvye (7)
edxbq (99) -> jsgsrv, acyxkb, lcbcww
jhfzno (7)
ndjsyxv (54)
xkjnqxt (67)
ptyviez (57)
szhwe (90)
uadkj (192) -> ywkzft, fkrtu
bywqwuz (91) -> cdeqon, xfvdujr, gihfpd
gmylh (44)
rtjkwbn (30)
zdjhcwl (66)
mswajqd (73) -> ibiaf, lhjozy
tuxkm (489) -> nhjvgxb, vtkbw, cpielxy, fifeh, kextji, jifqc, lpiwy
qmuazw (85) -> hdcmkki, grqseso
gjxaigd (6)
qvimm (107) -> pkbtagp, tplns
gpdsg (53)
fycuq (98)
ubdzcc (58)
ffqvgq (32)
riwgqj (31)
uqgenpm (6)
nkdlbte (45)
kiacut (189) -> ijxxafz, nnmzf, jhfzno
ucfaq (94)
cmudqw (26)
jwwsqu (5)
ocrev (97)
zvrtz (26)
wobfzn (8)
tzxwkb (89)
mfdjwh (70)
obpkdzo (137) -> ygqqkr, jaipy, xqcjp, svmkn, avtpx
rjygion (143) -> teodj, vzosyfw
wupnsik (29)
behex (84)
hbsis (53)
popjzo (262)
vipnwr (65)
crbeei (35)
ueufv (57)
lkyfah (37)
jtbcwjq (7)
fjbxc (150) -> mjxlf, qkgtm
egvwlf (81)
jyjji (179) -> wcxveji, gmylh, nsctoxg
jkpmsn (87)
dtknmk (57) -> ykwhg, hyjklqa, uephsn
vaccerp (25)
yrzxt (161) -> ktcnig, achjxnt
ozopo (66)
rrfdh (77)
jkdjvth (84)
mcpeye (318) -> asfwgmb, gjxaigd
xkkss (9)
zisdqe (43)
knelo (74)
inidjq (74)
fylaa (108) -> kfjcua, htojt
rcwqzo (59)
xfjket (2175) -> iqkbf, aamso
qqurzg (43)
ddbkda (73)
yfpcnc (93) -> gxmwofz, qhkla, uojka, uqfgzbd, hcjatuv, wkhzn
vyhdez (80)
uuoeums (10)
esnvoj (293) -> hqgaa, gkjgr
pljhg (48) -> kwhep, btbvzum, zupuwvd, pabnvuv
hcjatuv (237) -> pfgbnkk, blipho
qkgtm (10)
czuvl (67) -> vrunbp, mughrjj, sirhaf
dkjlm (89)
ymnncl (6)
tprjbwq (45)
jycqhpv (121) -> cplavax, nhhgwg
bkbdhpy (56)
umvbix (86)
oyhly (25)
nuyww (88)
jifqc (62) -> rqmxy, muqpq
rmpld (220)
qfxtrkn (54)
qtqamz (56)
ehqcxxf (54)
cplavax (95)
haqptiv (17)
frfoz (11)
vbcpbw (214) -> zewhoit, dfdgr
vjgydhw (77)
nsvacuv (11)
rxlbm (115) -> ntnsu, hosqqv
uyxqsd (43)
qtybotp (75)
kifpe (249)
pluvxuf (81)
bfjscic (43)
tmilb (75)
xjnlz (46)
yryfr (48)
nmaxp (94) -> fcqcyur, ozopo, ggtzix
hudvbxc (212) -> evhre, dxwcy
qpayfin (22) -> yryfr, nhpii
xmpqpg (97)
snpwoh (39)
mcqpdc (151) -> gzxjevb, zqxjvtw
ttdvtjf (54)
oehqml (117) -> unxmdz, gxxptz
xacxhce (53)
wioiwk (248)
stnpvm (70) -> lndjc, zcphmtw
qxjkp (25)
iowngw (66)
ikijpg (31)
awtow (131) -> kxizfxs, urmpuh
jbbvtrn (52) -> npjfimt, htpec, lnjspqb
hdcmkki (86)
kralaq (7)
wsabbfv (7656) -> lpaegfo, kacrmdl, nlhwox, ilpbn
rhonlc (87)
lmfai (301)
mrgsrr (42) -> qwtvd, dypcsf
mvmut (46)
xlyhib (61)
ljgsc (174)
kbbypuo (65)
cnige (63)
kshpdif (25)
nhjvgxb (32) -> zrrno, ikzinr
bejur (27)
rizsabn (34)
wjbmw (71) -> nptgvz, cnige, ifuzfon, kodimzj
ikvleu (27) -> wioiwk, jylmfmr, pljhg, boktp, spyfuqm, zfmmq, xkvcitn
jpdqo (13)
boktp (96) -> zanxayt, uugsv
iflcic (71)
fgspffp (77) -> scrnltq, sebok, vnsubpc, ufeocln, vdeontc, zwnzd
aijzm (42)
iyfxetp (44)
szjkk (66)
xznmwt (56) -> onuwbbd, sqjnkv, jgzab, gdtdu, rvuqzx, ttorn
ltwrhg (53)
sqjnkv (168) -> vfyse, gfptcod
psqjm (6)
lubmgd (242) -> iekxhkq, wcuvqq
eioau (216) -> sjwbz, bejur, xmhitb
soplysp (80)
epywc (47)
cldwtkg (1129) -> fonqobo, gmlan, vwdfgrf
ovmrzly (28)
djafp (57) -> umjobj, vsmeajf, jjdec
rvmws (23)
nrflc (65) -> xlbozyg, jjddhig, cjbgyv
ueksq (61)
jscdimo (96)
maxuvku (67)
teefbn (13)
nhpii (48)
hijnd (17)
eeeqsvu (167) -> loywc, fzivov, etgdn, cdtsmx
qyamco (127) -> zyqfx, stpuqws
ayzoa (97)
usaego (53)
eqwey (82) -> lpvfr, piorpbj, jqbaml, mcqpdc, vtkyt
mfxvwl (174) -> stgsru, qpwslud
jnvasei (45) -> thncd, mknlimt, cnwup
sljkvy (296)
wfwvaqn (87)
kusypo (183)
dgcqsdt (30)
ocnuv (33)
qdczl (273) -> iqxly, sdvha
sjwbz (27)
abixmt (61)
ilmafvk (72)
mgqstz (92)
fuvbvhs (14)
dhgnzfs (82)
upwoa (31)
eccwkzp (68)
olwja (98) -> tqtxfhm, klcsjwh, vhcyt, wzdrsta, sjrtrw
fjldqa (150) -> mvmut, chdkruq
qvxin (618) -> kifpe, yoccuxa, lbfdgiq, yhotfuz, ooxvdl
ebeetqx (61) -> mdnvlil, thmqhkt, qrmhcf
xzbak (135) -> ayzoa, ocrev
tvxkm (70)
aaonf (99) -> jkrrgc, iqukr, xacxhce, drbpja
ozxyxq (37)
uxvcxh (84)
ubuqah (221) -> ectklb, kezul
iytkzsm (23)
vgtnpep (62)
qmkys (79)
jjddhig (89)
xoryc (10)
ifelh (33)
iopbc (158) -> ilfdcj, kkfhcsy, pcyrbl
etbuosn (11)
clmenxm (49)
zuwikrs (9)
dimle (11)
ztpfdz (136) -> jlvja, byorxyl, lqmpsd, jkzsy, fmsocmm, fnhsm
edjjtzx (67)
wupjq (147) -> jprsosh, ryvrxgz
etmuwht (88)
cxzbz (8)
skmgcwd (1236) -> nmaxp, zgubutf, rogpal
rjrvegw (96)
touys (23)
vdeontc (119) -> yybjg, hqqse, fpbqwuo
kdebo (93)
wunvz (1213) -> thhjd, voyguka, uuvtgxs
axydpr (46)
hqmwv (37)
gcprg (661) -> hbtks, lubmgd, pkqzgez, pmpaifr
ubkmej (1371) -> jrjxwv, rjygion, xjqfjjz, ocsmcbd, orhsk
evuyvwi (258)
voyguka (183) -> hmpbt, qiyjybx, szhxrs
lakrsa (96)
ryvrxgz (82)
seyqpm (55)
sopykc (16) -> zcekwb, seyqpm
mrubh (84)
yrqddoe (10656) -> cldwtkg, wunvz, uzuvkb
abpkbu (227) -> ifcknge, idzev
xyaccp (316) -> melfgs, kxpksvs
svmkn (42) -> ttahyfy, buvcl
vmuixj (99) -> jnjuu, zvjroe, cxkmf
nidfqb (92098) -> hemos, fbjbenu, ktxvga
yqorsvq (84) -> rcwqzo, rlrdbx, huukh, ryxmq
fglig (90)
mevvp (177) -> jbbyz, qyeeed, vxvyfq, mzheh
nowvtp (50)
qorkwm (56)
ifkpolv (23)
ziruxh (73)
rejhfa (53) -> uutvza, nqmaj
fshgk (1503) -> fxaldct, vxpbidb, puqqobq
aabvhmt (33) -> yrczz, zgfzjw, nrflc, mzupyvi, woryzzt
vtjavjo (340)
yvovn (199) -> ehajl, cmfvb
nltpwwe (258)
vsmeajf (98)
cmrrpub (35)
pmpaifr (212) -> ydcvaxr, xibbt
qfxtbjy (123) -> bydzvyp, kmgpega
wcuvqq (8)
eiussi (25)
kzrfts (75)
wkuznfn (7)
rghjet (236)
ckxhsgc (88)
lqwqtn (42)
ilpbn (45) -> ngleuc, pxdov, yesajx, vesyuoj, oehqml, cqwxdp, yudfzy
bdtgu (370) -> hieah, fozkkcu, gaubui, xoryc
nxgtet (80263) -> sgzrp, olwja, bnjvzm
ozbbkqo (188)
nyhfelu (81) -> ibkez, mghieov, ebeetqx, gzdyzt, vtjzdxy
eqxyc (42)
iakbcf (132) -> rlgjtrj, pjvwsiw, bitieb, klixal
xzdshuy (27)
klixal (23)
rxszmq (46)
fpbqwuo (67)
qbvkpe (96)
jylmfmr (142) -> tvpibkw, hbsis
iylad (33)
bomtmfz (25) -> vmuqhd, kghbw, usaego
vwdfgrf (67) -> wjapp, iekqd
mpdslg (235) -> xabuih, waptxc
hteghne (98) -> joodfi, zcpxes
qrgdmec (15)
ktjaj (8)
ttrgg (10) -> vdsbe, tusctxe, euotkk, qcwsklt
zvjroe (36)
ypbzq (50)
ectklb (39)
nuvvxyn (89)
vkqubvl (147) -> yuuerck, vjgydhw
dnrip (81)
ofccrnd (72)
avtpx (123) -> nsvacuv, khkfmv, wfoiilm
znlxlcg (24)
aiboxmm (61)
judwkbu (42)
fxaldct (137) -> ocnuv, iylad
wtpxw (61) -> mcpeye, edxbq, erivgb
ikzinr (70)
wpwznmz (84520) -> xejfy, iunxdgt, exbktzw
vuuaxqy (133) -> hbrvv, sgtmlrz, patmi, ljjqf
sunujj (54)
uojka (7) -> lakrsa, qbvkpe, jscdimo
smxjozz (50)
vkyao (28)
zvtpq (45)
iqvwlqn (354) -> kralaq, mimcbh
esohm (154) -> xygced, bizdfe, xfpxpx, frfoz
pigdjl (39)
ocxzx (67)
cqfxi (1809) -> cvzeesz, anjiu
cllehlw (490) -> llqupt, waulitx, klzzulo
vwsjwcg (26)
cqwxdp (261) -> xflnupp, tdseul
qdywe (34) -> ddbkda, ztmkhsi
enkehcp (113) -> wgeunee, wyjrhn, rlnnd
xlklkc (8)
cctmov (71684) -> ixwae, bxdgmn, jyphghz, hxvtdmo
tsqkiu (18)
phuotb (70)
vcfqujp (28)
thhjd (79) -> jxoqq, ziruxh
fmsocmm (24) -> cxabeig, bruxv
uugsv (76)
gvsuwlg (84)
kbbjtyg (87)
ypllox (96) -> jczdsk, nwyda, abxssw, vtjavjo, xyaccp, asyawj, rdnngm
llqupt (227) -> hdmqg, upwoa
gopeu (44) -> vcfqujp, pdhpepa, lqxyojf
fonqobo (253)
lmwoc (2129) -> jpdqo, teefbn
emyhta (65)
wwohfj (62) -> rkwmzgm, spdkd, teybst, wycwvml, mpdslg, gymgi, qyamco
ieivml (18)
osqday (43) -> wblqauy, sloxho, fglig
webmmgo (88)
jxromai (98)
oikinqf (89)
vpvkbw (1965) -> dscum, negudlz
mmkcr (61) -> usgysj, qmuazw, lokze, hohqte
oqoqm (53)
ycuqlop (97)
pgkhpe (14)
htxdkps (8)
dnhetjz (19)
bizdfe (11)
hmpbt (14)
hyjklqa (67)
lqmpsd (206)
jacwd (66)
nguqx (33) -> oxbklc, exdtq, ucfaq
dgwdg (94)
ifolq (98)
ocsmcbd (99) -> fcqdawn, jmzvoqc
yfqtq (21) -> zrybo, enkehcp, ytfles, iakbcf, mkweog, dmxoahi
shctoqf (72) -> epywc, jvswzb, ogjlsrm, bfmytsg
qsemnni (57)
hosqqv (90)
fnhsm (28) -> rojkbth, tzxwkb
alxmpvp (99)
qboxw (25)
iuyweov (646) -> hlvga, zynluws, fjldqa
edkqwuf (56) -> ubdzcc, oifez, mzcthu, tokwcu
muqpq (55)
zruqkga (10)
kodimzj (63)
ttorn (172) -> rxszmq, ljijxpn
xmhitb (27)
gjbcnzu (134) -> eugkb, egvwlf
nyaqezh (280) -> zdwopu, gdjggn
xqtnm (24)
gaubui (10)
bejxxg (209) -> ztmstn, pigdjl
vxpbidb (47) -> ajnlwc, fawkcaz
onctzij (74)
dpqqxt (56)
rcxkic (32)
dfdgr (77)
gzxjevb (36)
ixwae (74) -> onidyci, dafgra, uotry, ikvleu, drcop, iupknn
vfucql (201) -> cfwyzkr, qocfe
sfqmqy (38)
nwyda (164) -> nuyww, pqzrjkt
juiuue (34)
fvkbv (23)
majtfq (81)
vtkbw (132) -> tcjgzre, aqimqdw
newtdcb (16)
qmnrutp (53) -> xmpqpg, cwbla, ycuqlop, sjvvhzu
lmufjo (42)
tniixxs (26)
kzjms (72)
jmzjnp (94)
oskscjs (53)
fflxioa (54)
qwvtuwd (18)
biyezz (67)
oxbklc (94)
gnrpob (50) -> ckxhsgc, zghem
pngpw (97)
fyxsvdg (225) -> rhnaxsw, jcoebbh
fbjbenu (1970) -> ejdaq, jbbvtrn, paaduig, cllehlw
gyvdr (106) -> lkyfah, ozxyxq
ztmkhsi (73)
saxaeg (53)
cxkmf (36)
uutvza (97)
fcqdawn (61)
mhbquyl (1475) -> kxrxuf, tdrbhcf, wzgjsu
jcoebbh (42)
tqintl (68)
vtjzdxy (218) -> ovmrzly, ibiel
anjiu (94)
tlqke (94) -> qfxtrkn, dksjicx
hzimwtl (133) -> vlqzxbw, vzxqna
awjbrzo (333) -> gqhdxow, fxoef
lyupi (182) -> nmnmck, fuvbvhs
xeqnonk (129) -> mwurel, pfwwvb
fcqcyur (66)
gfywx (77)
acyxkb (77)
ywyofh (71)
iyznnfg (23)
jjywn (23)
ccnrp (279) -> mbaho, grsav
fifeh (10) -> pluvxuf, cofxr
hlvga (83) -> saxaeg, lidiig, byfkv
oifez (58)
emqjhi (80) -> wdlxm, fhodd, wjbmw, omksd
dhgms (26)
pmopfeu (75)
alnsic (184) -> jtftcpd, pgmjg
zxdchgh (75)
fawkcaz (78)
jjmde (84)
iekqd (93)
patmi (19)
dzwtp (207)
aiqvx (83) -> cbsynx, smxjozz
klcsjwh (1739) -> hteghne, zciuw, fjbxc
xxngw (79)
ryxmq (59)
xafaqgt (176) -> eqbotm, layjn
ynysym (1350) -> deeaiy, fjhaeec
sztfxp (42)
wdlxm (323)
futjpq (58)
phkkuas (55)
tnqzub (66)
lrjhm (82)
gfptcod (48)
kxpksvs (12)
edxqkir (86)
qqouxxb (11) -> jwazwcn, huzlnn
dzqjyp (16)
ervqorq (72)
nhhgwg (95)
azzob (85)
xibkhsl (58)
iayhm (98)
ggzhodw (42)
byfkv (53)
uzuvkb (82) -> vkqubvl, dmpho, lmfai, mjvue, syuhhng, hzimwtl
xnjkew (68)
qyeeed (21)
grqseso (86)
jnjuu (36)
gkabumy (93)
vzxqna (84)
lsfgf (65)
hpqgfkt (37)
drbpja (53)
dczrmrn (60)
vwxvg (99)
exbktzw (3459) -> vpvkbw, bfolyt, lmwoc
yuuerck (77)
jjdec (98)
jawss (77) -> ywyofh, nkdhtp
pwtrm (98)
pqvig (86)
xygced (11)
hxuqet (89)
ogjlsrm (47)
towalrd (38)
jgzab (194) -> crbeei, wxgyxuk
ifcknge (88)
ibkez (274)
kwhep (50)
dblxqm (54) -> xqtnm, znlxlcg, ntkok
syuhhng (91) -> kfwlsg, phuotb, cxxmse
evrueat (207) -> mcpzoc, xkkss
ozsgjxl (74)
acbcjs (72) -> jsuadiv, pxrjx, knelo, ozsgjxl
iohloti (42)
bmqbgr (20)
hohqte (247) -> bmoohck, civncp
teodj (39)
nrndbk (27)
twxqe (56)
eyfgb (7)
gkjgr (29)
veuvvmm (137) -> fvkbv, bmgpwm
mizef (27)
ifryukv (77)
hekzcw (67)
spxwg (26)
egbzge (1086) -> gokeude, tmgvgbg, qqouxxb
uhaavxe (65)
oeyouc (180)
xduyex (57) -> rrpfg, uduzy
otxia (58) -> eqxyc, mcvpp, iohloti
ubjywkt (49)
mzheh (21)
ambdei (860) -> baktger, czuvl, iniflxu
mzcthu (58)
zcekwb (55)
hubjr (169) -> fgvmo, akrzzb
vevyi (201) -> fckjb, nowvtp, nrsiuud
ibiaf (67)
rvuvobj (42)
ylnaa (29)
agwosix (72)
hdgqk (159)
xjhum (155)
prhiv (38)
uodfc (227) -> rvuvobj, jnifuzx
vcppteu (108) -> twxqe, vgixiv
rpatowl (57)
taiqda (57)
kohzprg (7)
ijxxafz (7)
fpzszs (31) -> cxkqdb, ocxzx, jesujv, oxgbyb
chdkruq (46)
lvsixy (315)
znxkywx (25)
xfpxpx (11)
tukdnuw (98) -> zsessdj, urgczwj
whkgy (71)
ireai (32)
ifuzfon (63)
trcof (156) -> blzhw, vjxddho
zkasz (7)
asfwgmb (6)
zwnzd (298) -> sbmcami, etbuosn
hqqse (67)
vrunbp (57)
gymgi (13) -> jfhkwr, gfywx, rrfdh, cyootl
olimc (12652) -> edbtcbw, dgnvuj, vllmp, obpkdzo
lvuefvj (88)
tzclsaw (126)
zanxayt (76)
xeyvjw (35)
lfwknhg (521) -> vevyi, djafp, esnvoj
gxmwofz (184) -> hpqgfkt, qczmoy, dgrayrh
fgvmo (86)
cwbla (97)
wzcayoy (90)
sxufas (264) -> qrgdmec, ruyoqd, hgdxmok
zgyhdab (83)
blzhw (33)
bfgomg (160) -> xnjkew, tqintl
smrpclw (70)
fjzonji (57)
oobxwrq (31)
eugkb (81)
mghieov (178) -> tzgwe, fdapy
zsessdj (79)
pqzpiv (84)
dxxhd (94)
ksbozfy (74)
hemos (471) -> wwohfj, obycj, wcjpoyg
qqkxysp (128) -> uhaavxe, kbbypuo
nqmaj (97)
zlqxoxj (136) -> lqwqtn, aijzm
ifesfz (32)
dgnvuj (56) -> izqubf, bejxxg, uqriw
yybjg (67)
huzlnn (88)
buupjox (97)
ysdkfu (181) -> dnhetjz, jkwkjl
piorpbj (27) -> qrdhjs, iayhm
eunyg (93)
tqtbmm (112) -> dutztky, zjifm
kizide (236)
tcjgzre (20)
xgpirvu (293) -> fraje, zuwikrs
tjvfdfz (20)
iyoqt (11)
yesajx (127) -> kskeewt, yvajxn
yeimmz (7)
sutafx (40) -> onctzij, inidjq, ocril
sgoshgb (45)
wblqauy (90)
jlvja (146) -> cvsoun, riliib
ftygj (25)
vkxpxq (92)
jkwkjl (19)
ntggl (72)
cnxxf (11) -> gtczky, kogwes
ygxkvhb (29)
wwfmfcj (603) -> esohm, pkweyzw, wilnykk
uqfgzbd (209) -> zisdqe, jaagtdp
aqimqdw (20)
lndjc (75)
sfhdkpn (18)
oqpdxx (92) -> dpsxw, ofccrnd
jaagtdp (43)
wtlkg (167) -> tniixxs, spxwg
huukh (59)
cxxmse (70)
rxhpa (17)
ljjqf (19)
kdqzty (66)
qibuqqg (34) -> oxxhpbs, tiekffc, nxgtet, nidfqb, cctmov, wpwznmz, dwggjb
lmufb (70)
xkvcitn (64) -> axydpr, tzxupm, xtezgtw, xjnlz
tpvbav (25)
ioxmx (44) -> giyxwy, zgyhdab
xagbypb (25)
ygqqkr (36) -> dczrmrn, dzgulv
thmqhkt (71)
cjbgyv (89)
euotkk (63)
dovyfja (70)
mywtwkp (62)
akgcp (31)
fraje (9)
ibiel (28)
pxdov (30) -> sjbou, tgldx, luuzxwq
htojt (9)
krrcbjx (776) -> wdadod, nxcieso, vfucql
gcvdke (8)
ipmgw (8)
otaunrw (486) -> qvimm, lmjvnxu, ptswbcq
uarcn (179) -> jrjmq, eccwkzp
svurvs (239) -> ovlxf, vkyao
zrybo (224)
hxvtdmo (92) -> totazq, fshgk, csdqn, skmgcwd, prgwy
dtabm (87) -> mdday, mjwvg, oweiea
bwlqyc (1899) -> csnye, ozbbkqo, gbyvdfh
jpsne (62) -> ythalh, iyznnfg, touys
pabnvuv (50)
kextji (96) -> gotxizj, prhiv
orhsk (53) -> sztfxp, lmufjo, lzlvn, judwkbu
ovlxf (28)
alwpa (7)
bplnj (30) -> jrbzztr, pqvig
gmmckzh (85)
wilnykk (32) -> jwegx, evgxmez
jwazwcn (88)
iqkbf (74)
wgeunee (37)
jrbzztr (86)
zlbnr (35) -> qmnrutp, srjngls, khxepx
qzdjjn (222) -> esnwek, hijnd
galqo (40)
jvrkpk (68)
czhlwz (41) -> rjrvegw, eufzbzr, djyhfz
tmtfuf (75)
gabui (31)
jhcgku (55)
xflnupp (21)
qhkla (281) -> yeimmz, oecex
xulafyj (104) -> haqptiv, rxhpa
ehajl (48)
yoccuxa (51) -> vwxvg, wlaam
juiyrea (60)
pxrjx (74)
tntscn (93)
cnwup (84)
uuvtgxs (105) -> juiyrea, pqath
mcpzoc (9)
dafgra (971) -> hqssm, khflwz, upobs
xvjal (66)
tdseul (21)
gokeude (81) -> gpdsg, oqoqm
cvzeesz (94)
bfmytsg (47)
vghsys (42)
sgtmlrz (19)
llzvof (18)
jjjqkd (235) -> pkwqon, nlhhk
zefrbv (195) -> abixmt, wyhbih, xlyhib
tuftot (56)
drcop (533) -> jzdadfh, bdtgu, vpgvec
kwxvi (54)
sjrtrw (737) -> dtabm, zefrbv, vpsll, idcfpgl
iupknn (1142) -> ndxetw, gpgyc, hxfoffi
negudlz (95)
mimcbh (7)
muijxbl (159)
hegupfl (80)
dwzfad (571) -> vcppteu, zlqxoxj, stnpvm, rmpld
ykwhg (67)
gxxptz (93)
luravk (27)
zwtsl (191) -> htxdkps, wobfzn
fbwls (251) -> tprjbwq, zvtpq
vorvnct (70)
rdojoa (40)
yidgsn (57)
imhhjy (67)
zxmjji (43)
aywuxzo (84)
nxcieso (225)
wknuyhc (78) -> xznmwt, mhbquyl, alfjsh, pxfelm, egbzge
oyddjae (36)
jzgcpsz (206) -> rpatowl, ryfjz
vsrjug (43)
nlhhk (30)
cvsoun (30)
scrnltq (59) -> kfeug, wfwvaqn, rhonlc
exqli (65)
kskeewt (88)
pxuehns (31)
xtezgtw (46)
dgteclr (92)
qihiao (489) -> wtlkg, oijsua, ysdkfu, litlpci
xabuih (43)
nkdhtp (71)
ejtsnf (36)
mknlimt (84)
vhedbl (67)
pfuzvg (196) -> xagbypb, dxlfp, ftygj, tekedi
akrzzb (86)
oxxwym (85)
rvuqzx (36) -> taiqda, qsemnni, ptyviez, ueufv
zsdteo (48)
ttahyfy (57)
kkfhcsy (34)
onidyci (988) -> ldieem, xjhum, cfxyodh, vtsjose, qfxtbjy
uhjrbpf (45) -> qdczl, eeeqsvu, abpkbu, awjbrzo, jwjbd, ccnrp
maiosjr (56)
kezul (39)
pvqezp (26)
vpgvec (316) -> szyqd, vcgiqc
yrleh (58) -> xeyvjw, bprygo
yyetp (56)
hpvjhyp (15)
obycj (1473) -> awtow, vuuaxqy, qbjvco, xeqnonk
fhlic (1080) -> daxksv, mevvp, pwaeh
ktxvga (9) -> bwlqyc, uhjrbpf, wwbqatx
llykh (35) -> tcklgm, fjppxby
kghbw (53)
mughrjj (57)
rxioey (52)
hbtks (57) -> vmjkq, imhhjy, nhvuag
onkqn (32)
zciuw (56) -> fjzonji, pfyqgo
rlpprxr (82)
tokwcu (58)
wzvqq (50)
rvqrjoq (97)
mjvue (137) -> zgklk, lrjhm
axtlgbv (56) -> iyfxetp, nalyti, ufvts, yjlqjsb
sdvha (65)
mdday (97)
mbxvcsi (1840) -> llykh, muijxbl, hdgqk, ghktu
uephsn (67)
ctilgze (104) -> dpzkyyl, cfqmuc
xarudni (119) -> biyezz, edjjtzx, hekzcw
bprygo (35)
tpfxe (172) -> onkqn, wtqnsfh
abtsnp (70)
ljijxpn (46)
dypcsf (69)
rrpinn (202)
jtftcpd (9)
gqfksjx (27)
wvteah (40)
ktcnig (43)
ruyoqd (15)
tywib (68)
wyjrhn (37)
nvispnl (76)
pfgbnkk (29)
cyootl (77)
deeaiy (11)
dffolt (34)
djyhfz (96)
zgqqlbw (16) -> dzwtp, mswajqd, cnxxf, vmuixj, zwtsl
zgdbi (29) -> sxufas, bowfudl, ufczqd, ycbok, fyxsvdg
vywba (184)
idzev (88)
waxhr (80)
byorxyl (98) -> ndjsyxv, ehqcxxf
mhwxox (18)
yhkuob (236) -> vghsys, xyxcsxs
pcllirt (23)
egxdav (150) -> trmqa, osqday, exfcej
ntuzadk (59)
vnsubpc (134) -> vgtnpep, fznumf, elsikc
agwqkp (126)
sjbou (91)
iqxly (65)
rogpal (124) -> jkdjvth, jjmde
yvajxn (88)
hxfoffi (177) -> uuoeums, uhomaxq, zruqkga
yzmgfct (78)
jprsosh (82)
rgzaw (9) -> kbbjtyg, jkpmsn
ufvts (44)
oqgvwa (3872) -> ubuqah, fpzszs, lassvu
gefrhtx (127)
vxgqv (33)
mjxlf (10)
pzierfa (728) -> lyupi, ioxmx, fwiynqx
ufczqd (21) -> ilmafvk, gpvau, agwosix, ntggl
edbtcbw (260) -> pnunb, jawss, hqyjy
hqyjy (165) -> gqfksjx, nrndbk
oxxhpbs (52) -> yrqddoe, yfiqm, pwqemv, wsabbfv, gilaaof, mdamnrb, olimc
hcezd (36)
cfwyzkr (12)
qjikvc (29)
cymdgh (81)
qwtvd (69)
pqzrjkt (88)
buvcl (57)
jwjbd (35) -> nmbntq, uqhjg, bhcin, vkxpxq
kecxvp (82) -> mhwxox, ieivml
tgldx (91)
fjppxby (62)
tmgvgbg (55) -> tnqzub, xvjal
qpwslud (18)
sgzrp (8190) -> zgqqlbw, wtpxw, krprn
rlnnd (37)
gotxizj (38)
ilfdcj (34)
blipho (29)
tzgwe (48)
pwqemv (9495) -> qapbaz, aarqmkg, qihiao, hxthnm, yfqtq
mmxjtit (42)
suhcj (82) -> lmufb, tvxkm
fwiynqx (210)
zghem (88)
axjey (34)
nrcdoqp (270) -> psqjm, ymnncl, uqgenpm
kxrxuf (55)
vlqzxbw (84)
stpuqws (97)
bfolyt (90) -> jjjqkd, peqkaa, yvovn, byvql, rxlbm, svurvs, kgzkez
blqfsgv (243) -> hcezd, lljuruk
rqmxy (55)
wcjpoyg (1757) -> bomtmfz, otxia, vywba
uduzy (37)
zewhoit (77)
xwfahdl (76)
hvton (88) -> hldshzt, znxkywx
jnifuzx (42)
qiyjybx (14)
jkcayo (25)
pnunb (147) -> oyddjae, ejtsnf
pkwqon (30)
jtopr (310) -> ylnaa, qjikvc
szyqd (47)
rlrdbx (59)
evhre (25)
totazq (460) -> xafaqgt, rghjet, tpfxe, yrvyz, kizide, oqpdxx, dcayx
fblouo (309) -> mumya, iopbc, shctoqf
mzupyvi (52) -> mfdjwh, abtsnp, httjuy, vorvnct
lwgdm (61)
zynluws (128) -> yidgsn, papkps
vdsbe (63)
ldieem (155)
mwohema (83)
pkbtagp (47)
gxmmeh (22) -> crypnfu, rxioey
qcuiapw (72)
zthkuh (40)
jxiargx (83)
vfyse (48)
rglmbmp (48)
uoolai (86) -> xlklkc, sxnhost, ipmgw, gcvdke
txszrxv (40)
aamso (74)
hxthnm (355) -> rrpinn, tlqke, bplnj, alnsic, japeavr
evgxmez (83)
yfscq (256)
uqriw (23) -> etmuwht, qwwboex, yntek
mcvpp (42)
rlgjtrj (23)
mkweog (41) -> aiboxmm, lwgdm, ueksq
ptswbcq (15) -> iihcev, mywtwkp, ksejhbf
jkrrgc (53)
japeavr (152) -> vaccerp, tabkgei
wwbqatx (1581) -> sopykc, dblxqm, gxmmeh, tzclsaw, agwqkp, yfiumbq, fylaa
qcwsklt (63)
zgwzkg (72)
riliib (30)
gihfpd (12)
ngleuc (273) -> hpvjhyp, taniaeb
sloxho (90)
pfyqgo (57)
pkqzgez (64) -> rvqrjoq, buupjox
zgklk (82)
dsbbah (70)
qwcfnre (16)
diexx (54)
outfle (54)
abxssw (238) -> mrovove, whlcby
nhvuag (67)
kfjcua (9)
lcbcww (77)
zcpxes (36)
luuzxwq (91)
aarqmkg (288) -> wwjmto, nwiqs, itfdh
jrjmq (68)
peqkaa (249) -> ifkpolv, rvmws
dutztky (31)
litlpci (49) -> azzob, uohje
bypjz (86) -> webmmgo, euhalzn
cfxyodh (21) -> vhedbl, cousytu
moeaqn (83) -> yhkuob, xarudni, nyaqezh, jzgcpsz, ijdqdd, ijeid, yqorsvq
bmoohck (5)
mdnvlil (71)
eqbotm (30)
qldwji (26)
qczmoy (37)
fckjb (50)
qwsxy (1555) -> tukdnuw, qzdjjn, yfscq
iqukr (53)
iihcev (62)
tusctxe (63)
oijsua (119) -> wzvqq, waosofl
hgdxmok (15)
urgczwj (79)
pkweyzw (112) -> pnqpyiu, sdqqnul
wwjmto (281) -> uoiiwmn, ahzwjdk
jmzvoqc (61)
kgzkez (25) -> cbvsf, wzcayoy, erpgc
xdxdnki (86)
exfcej (279) -> hwuez, fuxnj
hldtfm (97)
hqgaa (29)
vtzrqqr (83) -> iflcic, whkgy
zewyub (75)
xsagpv (1582) -> yrzxt, qqxkimf, rejhfa
sjvvhzu (97)
jzdadfh (18) -> pwtrm, ifolq, fycuq, jxromai
athxv (26)
oeyqlpo (86)
kacrmdl (1500) -> insblu, trcof, suhcj
waulitx (137) -> xwfahdl, nvispnl
srjngls (307) -> xkjnqxt, maxuvku
grlhmxk (157) -> acbcjs, iqvwlqn, uadkj, jtopr, vbcpbw
vtsjose (35) -> rdojoa, galqo, txszrxv
lassvu (53) -> dhgnzfs, rpparsr, rlpprxr
yntek (88)
miedmry (280) -> xiysy, dvsdal
qbjvco (37) -> xdxdnki, umvbix
zcphmtw (75)
erpgc (90)
ognal (288)
fzzrvz (99) -> qwcfnre, nrodugs
xvybzq (76)
btbvzum (50)
yfiumbq (126)
uotry (1241) -> ljgsc, qzcyvto, tqtbmm
zgubutf (292)
dxlfp (25)
zupuwvd (50)
izqubf (89) -> szjkk, jacwd, zdjhcwl
cdeqon (12)
atuuyrx (165) -> qqkxysp, evuyvwi, dtknmk, nltpwwe
xxcraoi (77)
lwrfe (94)
ijdqdd (244) -> bgiclq, towalrd
xyxcsxs (42)
elsikc (62)
txmbb (81) -> kzjms, lwrti
hwuez (17)
zehri (50)
mmwgryx (40) -> gkabumy, eunyg
rpparsr (82)
rkwmzgm (275) -> jjywn, iytkzsm
nmnmck (14)
uohje (85)
zymhjli (41) -> ebavy, tmilb, zewyub, pmopfeu
kxizfxs (39)
zfmmq (248)
yqroh (78)
cdtsmx (59)
xjqfjjz (131) -> sgoshgb, nkdlbte
lbfdgiq (249)
pgmjg (9)
fjhaeec (11)
wycwvml (177) -> mmelu, zgwzkg
gqhdxow (35)
jjnssp (1930) -> xduyex, fzzrvz, jpsne
cvloxmx (43)
khflwz (168) -> ireai, ofqta, rcxkic
ftcnd (49)
fuxnj (17)
qocfe (12)
cpielxy (126) -> pcllirt, kyyrj
nrodugs (16)
vzosyfw (39)
oxgbyb (67)
phpie (5)
hieah (10)
gzdyzt (246) -> lryqvye, mzhkda, qjytnnh, eyfgb
atjdsy (25)
hdmqg (31)
crypnfu (52)
vjizib (149) -> sfqmqy, rtefwzu
vtkyt (223)
tzxupm (46)
spdkd (187) -> rltsl, fhwrk
taniaeb (15)
bttlvt (125) -> tntscn, kdebo
ggtzix (66)
waptxc (43)
vpsll (266) -> bkbdhpy, yyetp
dcayx (172) -> ifesfz, ffqvgq
bhcin (92)
cbsynx (50)
melfgs (12)
jnkkh (974) -> sekmr, yrleh, gopeu
ajnlwc (78)
wyhbih (61)
iniflxu (170) -> dffolt, rizsabn
whlcby (51)
nwiqs (77) -> jmzjnp, lwrfe, dgwdg
prgwy (278) -> ttrgg, hudvbxc, yispnm, sutafx, popjzo, bypjz, fdrrmpa
tiekffc (99985) -> cphtj, xaegh, oqgvwa
dqmiblx (43)
esnwek (17)
nptgvz (63)
grsav (62)
omksd (165) -> xxngw, qmkys
yispnm (188) -> hqmwv, fevjal
cphtj (1178) -> eqwey, wwfmfcj, atuuyrx
dscum (95)
rtefwzu (38)
eufzbzr (96)
usgysj (87) -> oxxwym, gmmckzh
qwwboex (88)
khxepx (373) -> axjey, juiuue
xiysy (8)
nrsiuud (50)
cbvsf (90)
jqbaml (171) -> pvqezp, zedeg
hqssm (192) -> klwfoky, tsqkiu, sfhdkpn, llzvof
jfhkwr (77)
mdamnrb (15624) -> axtlgbv, qurnsf, zlosilf
byvql (171) -> akgcp, pxuehns, oobxwrq, riwgqj
qzcyvto (57) -> snpwoh, ajhvcd, zjslurb
ywrrasc (56)
kmgpega (16)
qduoa (14)
etgdn (59)
gilaaof (11967) -> nyhfelu, dwzfad, krrcbjx
fozkkcu (10)
vzrnp (1216) -> lvsixy, nguqx, uarcn, blqfsgv
zjslurb (39)
fdrrmpa (252) -> jwwsqu, phpie
loywc (59)
xfvdujr (12)
lpiwy (106) -> vxgqv, ifelh
nnmzf (7)
oxvjgr (29) -> dkjlm, nuvvxyn, ezoovb
pfwwvb (40)
yinkdo (329)
vesyuoj (243) -> rtjkwbn, dgcqsdt
dvsdal (8)
rabgew (45) -> zkasz, alwpa, jtbcwjq
mwjeqwz (74)
bruxv (91)
pdhpepa (28)
zjifm (31)
csdqn (40) -> astgftf, oxvjgr, sljkvy, bfgomg, miedmry, gjbcnzu, pfuzvg
jkzsy (106) -> zehri, ypbzq
hbrvv (19)
gjobtb (84)
jbbyz (21)
pxfelm (617) -> hubjr, fbwls, zymhjli
spyfuqm (164) -> mmxjtit, ggzhodw
xejfy (5568) -> fblouo, mmkcr, otaunrw, egxdav
jesujv (67)
wklofr (29)
mzhkda (7)
qqxkimf (207) -> bmqbgr, tjvfdfz
zgfzjw (222) -> jhcgku, phkkuas
rojkbth (89)
vjxddho (33)
sxnhost (8)
dgrayrh (37)
ywkzft (88)
yrvyz (100) -> tywib, jvrkpk
lnjspqb (327) -> outfle, sunujj
idcfpgl (266) -> qtqamz, njsswa
jwegx (83)
puqqobq (151) -> athxv, vwsjwcg
rubia (206) -> nrcdoqp, pxmnf, edkqwuf, ognal
fqyac (78)
lljuruk (36)
qurnsf (48) -> dgteclr, mgqstz
rqycar (90)
daxksv (199) -> ikijpg, gabui
dpsxw (72)
cmfvb (48)
wjapp (93)
dmpho (301)
tabkgei (25)
oecex (7)
jvswzb (47)
wfoiilm (11)
qrdhjs (98)
qyfvxit (52) -> wkuznfn, kohzprg
hudcat (96) -> wupnsik, ygxkvhb, wklofr
tvpibkw (53)
jaipy (86) -> cmrrpub, byvna
xognshr (99)
nmbntq (92)
erivgb (200) -> lsfgf, exqli
bmgpwm (23)
airdbn (27)
ezoovb (89)
xybun (26)
bnjvzm (5754) -> yfpcnc, fhlic, qvxin
pwbfg (48)
qjytnnh (7)
xibbt (23)
zqxjvtw (36)
dmxoahi (44) -> szhwe, rqycar
zqvhfso (18)
jrjxwv (135) -> gncazur, bfjscic
uiqzp (33) -> zxdchgh, kzrfts
iunxdgt (20) -> ubkmej, mbxvcsi, vzrnp, ypllox
tdrbhcf (55)
nalyti (44)
szjdhf (59)
vgixiv (56)
ftkmah (8)
umjobj (98)
woryzzt (178) -> ifryukv, xxcraoi
dksjicx (54)
teybst (173) -> ksbozfy, mwjeqwz
htpec (201) -> yzmgfct, yqroh, fqyac
ttvuu (56)
lzlvn (42)
mabmz (119) -> ltwrhg, oskscjs
achjxnt (43)
pqath (60)
bzexy (86)
ebavy (75)
mjwvg (97)
njsswa (56)
zedeg (26)
fkrtu (88)
bowfudl (197) -> maiosjr, tuftot
upobs (98) -> jxiargx, mwohema
pwaeh (99) -> gwdydcb, kwxvi, fflxioa
nzlpjp (40)
yaccbth (94)
xqcjp (156)
cofxr (81)
thncd (84)
urmpuh (39)
vcgiqc (47)
gtczky (98)
ytfles (64) -> vyhdez, hegupfl
bllhx (1432) -> jnvasei, eioau, xhmrm
gpgyc (207)
dxwcy (25)
bgiclq (38)
sebok (126) -> pngpw, hldtfm
euhalzn (88)
wzgjsu (55)
jsgsrv (77)
bfgwxxd (27)
nsctoxg (44)
ztmstn (39)
lqxyojf (28)
ahzwjdk (39)
yfiqm (59) -> tqzha, qwsxy, xfjket, jjnssp, xsagpv, moeaqn, bllhx
astgftf (244) -> dhgms, kdqyfds
baktger (130) -> ttdvtjf, diexx
xlbozyg (89)
ydcvaxr (23)
rltsl (67)
ocril (74)
dwggjb (89458) -> ikplxqu, wacoc, wknuyhc
unqwi (8)
jxoqq (73)
tekedi (25)
yhotfuz (195) -> bfgwxxd, luravk
civncp (5)
wcxveji (44)
fxoef (35)
zlosilf (146) -> zxmjji, uyxqsd
lokze (14) -> dnrip, majtfq, cymdgh
uoiiwmn (39)
rdnngm (168) -> asnff, edxqkir
klwfoky (18)
pcyrbl (34)
fzivov (59)
stgsru (18)
mmelu (72)
lidiig (53)
wacoc (2846) -> jnkkh, zlbnr, pzierfa, rubia
cfqmuc (61)
wdadod (53) -> qqurzg, cvloxmx, dqmiblx, vsrjug
kyyrj (23)
byvna (35)
gdtdu (120) -> rglmbmp, pwbfg, zsdteo
ryfjz (57)
wlaam (99)
qzyvb (84)
onuwbbd (40) -> qorkwm, dpqqxt, ttvuu, ywrrasc
uhomaxq (10)
xqmnq (11)
vllmp (368) -> aiqvx, veuvvmm, uiqzp
xynghq (20) -> szjdhf, ntuzadk
wkhzn (145) -> tmtfuf, qtybotp
bgpsild (66) -> qcuiapw, ervqorq
fdapy (48)
yjlqjsb (44)
ksejhbf (62)
dzewqbg (84)
asnff (86)
lpaegfo (1262) -> ctilgze, mmwgryx, gnrpob, lgkdf
asyawj (88) -> mrubh, aywuxzo, behex
dzgulv (60)
csnye (68) -> nzlpjp, zthkuh, wvteah
ythalh (23)
sbmcami (11)
trmqa (213) -> tpvbav, atjdsy, jkcayo, eiussi
bxdgmn (5164) -> emqjhi, ynysym, ztpfdz, iuyweov
aowffn (88)
uqhjg (92)
yrczz (160) -> bzexy, oeyqlpo
nlhwox (1785) -> gefrhtx, bywqwuz, uvtwg
ghktu (123) -> zqvhfso, qwvtuwd
tqzha (1336) -> yinkdo, czhlwz, xzbak
vhcyt (72) -> xgpirvu, bttlvt, wupjq, aaonf, jyjji, uodfc, jycqhpv
xhmrm (297)
fhodd (113) -> dovyfja, smrpclw, dsbbah
klzzulo (91) -> xognshr, alxmpvp
ejdaq (1093) -> iowngw, rabgew, kdqzty, qyfvxit
cxabeig (91)
zyqfx (97)
mbaho (62)
khkfmv (11)
wzdrsta (1835) -> hvton, xynghq, xulafyj
fevjal (37)
gdjggn (20)
vmjkq (67)
gpvau (72)
ooxvdl (217) -> ktjaj, unqwi, cxzbz, ftkmah
kfeug (87)
jsuadiv (74)
zdwopu (20)
httjuy (70)
sekmr (24) -> qldwji, zvrtz, cmudqw, xybun
krprn (421) -> mfxvwl, bgpsild, kiacut
ehjhf (89)
fhwrk (67)
cxkqdb (67)
uvtwg (77) -> qboxw, qxjkp
lgkdf (38) -> dxxhd, yaccbth
waosofl (50)
ajhvcd (39)
hldshzt (25)
zrrno (70)
ndxetw (29) -> oikinqf, hxuqet
layjn (30)
xaegh (47) -> zgdbi, ambdei, lfwknhg
joodfi (36)
vxvyfq (21)
gofnx (76)
cousytu (67)
ntkok (24)
pnqpyiu (43)
ofqta (32)
sdqqnul (43)
yudfzy (127) -> lvuefvj, aowffn
exdtq (94)
kfwlsg (70)
wxgyxuk (35)
gncazur (43)
qrmhcf (71)
lhjozy (67)
paaduig (232) -> vjizib, evrueat, txmbb, vtzrqqr, mabmz
lmjvnxu (173) -> pgkhpe, qduoa
lwrti (72)
'''

TEST_INPUT = '''
pbga (66)
xhth (57)
ebii (61)
havc (66)
ktlj (57)
fwft (72) -> ktlj, cntj, xhth
qoyq (66)
padx (45) -> pbga, havc, qoyq
tknk (41) -> ugml, padx, fwft
jptl (61)
ugml (68) -> gyxo, ebii, jptl
gyxo (61)
cntj (57)
'''

TEST_OUTPUT_1 = {
    'name': 'tknk',
    'weight': 41,
    'disc': {'ugml': 251, 'padx': 243, 'fwft': 243},
    'height': 0
}

TEST_OUTPUT_2 = {
    'name': 'ugml',
    'weight': 68,
    'disc': {'gyxo': 61, 'ebii': 61, 'jptl': 61},
    'height': 1
}


class RecursiveCircus:

    def __init__(self, input):
        '''
        This input is rather complex so parsing it has been separated out.
        '''
        self.programs = []

        # Parse the input through a regular expression
        pattern = re.compile("""
                ^(?P<name>\w+)\s                      # the name of the program
                \((?P<weight>\d+)\)                   # the weight of the program
                (?:\s->\s(?P<disc>(?:\w+,\s)*\w+))?$  # the disc if present
        """, re.VERBOSE)

        for line in input.strip('\n').split('\n'):
            result = pattern.match(line)

            # Add in extra fields to aid in processing the data
            disc = result.group('disc').split(', ') if result.group('disc') else []
            program = {'name':   result.group('name'),
                       'weight': int(result.group('weight')),
                       'disc': dict.fromkeys(disc),
                       'height': None
            }

            self.programs.append(program)

        # Start populating meta-data, beginning with the base
        self.base = self._find_base(self.programs[0])
        self.base['height'] = 0

        self._populate_heights(self.base)
        self._calculate_real_weight(self.base)


    def _find_base(self, lowest):
        ''' Recursively find the lowest ring of this circus '''
        for program in self.programs:
            if lowest['name'] in program['disc'].keys():
                return self._find_base(program)
        return lowest


    def _calculate_real_weight(self, current):
        '''
        Populate the disc values with the real weight
        '''
        if not current['disc']:
            return current['weight']

        for program in self.programs:
            if program['name'] in current['disc'].keys():
                current['disc'][program['name']] = \
                        self._calculate_real_weight(program)

        return current['weight'] + sum(current['disc'].values())


    def _populate_heights(self, current):
        '''
        Given a ring of lower height, populate the heights of the programs on
        its disc.
        '''
        for program in self.programs:
            if program['name'] in current['disc'].keys():
                program['height'] = current['height'] + 1
                self._populate_heights(program)

    def find_unbalanced_program(self):
        ''' Find the unbalanced program and print its corrected value '''
        return self._find_unbalanced_program(self.base)

    def _find_unbalanced_program(self, current):
        '''
        Return the "problem" if found, otherwise False.  Will calculate and
        print a correction to the value.
        '''
        # Sort the current disc based on the weight
        weights = {}
        for program, weight in current['disc'].items():
            if weight not in weights.keys():
                weights[weight] = []
            weights[weight].append(program)

        # print(weights)
        if len(weights.keys()) == 1:
            return False

        correct_weight = None
        problem = None
        problem_weight = None
        # This program has an unbalanced disc
        for key, programs in weights.items():
            # Problem says exactly 1 unbalanced program!
            if len(programs) == 1:
                problem_weight = key
                for p in self.programs:
                    if p['name'] in programs:
                        problem = p
            else:
                correct_weight = key

        # print(problem)
        if problem:
            result = self._find_unbalanced_program(problem)
            if result:
                return result

            print('{} has a total weight of {} and it should be {}.'.format(
                    problem['name'], problem_weight, correct_weight))
            print('The individual program weight should be {}.'.format(
                    problem['weight'] - problem_weight + correct_weight))
            # Return the level with the unbalanced disc for testing
            return problem

        return False


if __name__ == '__main__':
    test_circus = RecursiveCircus(TEST_INPUT)

    test_bottom = test_circus.base
    print('Test Bottom:', test_bottom)
    assert list(test_bottom.values()) == list(TEST_OUTPUT_1.values())

    test_program = test_circus.find_unbalanced_program()
    print('Test Program:', test_program)
    assert list(test_program.values()) == list(TEST_OUTPUT_2.values())

    real_circus = RecursiveCircus(INPUT)

    print('Day 7: Part 1:', real_circus.base)
    print('Day 7: Part 2:', real_circus.find_unbalanced_program())

