import numpy
input = """focdealm
ggsipflx
rvibwxbm
vqrfyyrh
hsjtzpgs
ozymxpoy
jiecwags
lztseufl
dfwibwsn
skiuhnwl
kamgzqog
axeqncwa
gobivxto
nwgoryhd
tzrlitrq
uzoldxbv
zsteobha
pfcgdqkg
prcqlunp
iwivemkh
vpkilupm
ewuznabz
veaptost
cyvirffe
ejhhqfng
ibsqztgg
xzczkboh
bckhbodf
vbycgonv
esmoyyku
unccgdgj
cqwnqlzs
edoqmykb
bkvzlhyq
yzrspisn
zlzibhca
povnweaf
muyfegxe
oaojqfrl
gwesjxws
rjknfyeh
dkquvctc
cfuzhxoj
tdzzzfqc
lzjzsyni
wjfxckkf
xmhyjhop
kmtllzxs
yohearbj
ilmvyxgn
erczytzw
kuetjsba
vwkpollq
tujwluzc
jlvedjcp
acmoaoji
gqoliyen
agckavhf
ottamfdm
jxwlyotw
tdpsrapj
carwwmqc
ykaipjdj
zdfrbduu
vwiiosud
uoixglbw
yegbwxjb
wbpqqqfv
wpynmyqi
aqdkscgd
oghnbnnf
duftexbb
ttvbofay
jferymwy
hqzimpiq
sifyogml
nymxqbws
dhdlhhqp
urtuhcrj
giwcunfq
fxgretsl
maihqkpk
pdxfkcru
xixtthag
vuzxqzzi
wxxeleug
xpopxkzo
hgcsyuad
xcbydxnx
kxocfakp
erxdajeq
tliakzhh
iygbbuxs
qlgqthpp
duzzptwk
gfnqdotc
kjayxeqf
fehitfar
yemshppn
igtczmmw
gfajhxch
bslzmgwo
xpmhmirx
yhlwlupt
nymajupw
tlhgdefw
bqkudizc
lucrhmnm
svkoaqzz
luggfivf
ckawtiwy
eeivawhj
qdmmmvdl
quezzzqa
oimsfsuo
jdvcknqu
aupohqbk
llwsasnz
zlpljtjl
xfylqxlv
zqppxkul
varoizrq
yxryqwso
gsscetca
gcbdgqyo
hsdnvteo
pxtoreoc
rwjdkwzs
zdgofynf
polyntkx
jhulgrnf
ycbzpdpw
bzvdbwsy
vydjbucs
rxadwwuo
ccnvzjak
nombazjc
lbxwdasr
cbdlkiha
sdomdvow
phjnkkkp
nmtmrnyz
nxsvmcwk
hqimjvir
vmjhhuuv
zilhgqlb
gfgbibgg
imxxugfe
wtaffkbj
lyguqvjs
pejslhls
qjnefwii
oanqnnnc
kcjyfwxm
zoxjwxmw
ihmokcrm
uebsbhfr
fxvjiorr
ebjiucyt
ofutlokv
mdfnsuyr
dzviwqdk
umwyaijz
hdqwfalt
qtyrouwh
lkzcrtwa
dtqvwzke
buplmmca
xxepjuvj
omyotlar
ytndbwhi
sbntigym
mphrnsme
xiymeoxr
kcujxcih
bydnchgk
snwdjlip
yljsymtv
tyhbpoab
zlqhvzxl
akbtnzop
xnpjmysj
znhednen
vbcsocrm
ywjajour
ejngbqev
rstykfhc
cbcnoexq
mzlxvxwj
vfdqaalp
nbszzozr
dqpyojid
hfuqilbl
uoackeup
shqkcsmr
jbdasroe
fmlkvsnt
cnomxkvk
unbsfncq
bnzxltxe
bbadfyin
skmhtmhn
xkypwglb
flbfiioo
fzywneyg
srngxbut
qtodeuxg
xvawfqli
nyfmrdsn
rdjysbxj
spmezvvj
ofoivcuc
touzgqzx
mfqyzagc
dmaurbdv
gqnrlyuw
wuppusoh
qgstihuy
uldnlrpi
xaskgwim
djjrphid
qjhmctyu
osfenjdn
zvoahhkk
xiuyatyn
fepobmjh
kmugpjpw
aikpozqs
kmgmazif
gbzlodzb
hrocqadn
noekklwb
vzwhnkvx
osrspxsc
iekmqgua
xeehndee
quttqjav
htoptweo
cyicmwba
jltlwlyy
qvccdkig
bibggekq
kwfwvrfg
eycwlcup
murgcddl
lyukeubx
twbpzoyg
dkcvzele
fozhtmcz
frugeivm
qjbhpdpr
tgkkeroo
ryuvgqgc
jhixykqn
wsebmcrn
wohtjpgu
isflpxxt
xggwmamk
tfwdsrfe
cpjvcghr
fekhexdb
zcwzqofh
awnfiqzu
ihekvqby
rqaqajij
cumouwzx
ccyrflxd
rredygrk
patcpktn
mjnwuefa
tuhgyfsw
mjpxrgkx
hupfjqxo
mgkclcrf
jkmkhkci
nkcrwgqd
apmfiqpg
pxiawshv
ledhpfaz
btikmkwj
jwosopir
mgxftcte
phkbcdex
uakftnbh
fnkmdecn
swrvbjwj
hphskevf
trnpfdmy
odvmmqss
akvqgemq
zyqlkwdm
nbnaqjsa
mbnogzyt
mchaxjxu
tcqqerqz
ayylasgq
zqbrjfli
ccjjnfat
lvlpdjqu
luiabalt
qsvkepvz
dtyobsiy
jkulvrnc
thwjbzkh
vvhrwbkx
fhxejrff
bacuriaz
grmtyude
feynnckb
hfdepyjn
lvsfflyc
xfrgfgeh
vqqybtba
ntlfjqjt
zadauvmg
itukkpqf
mrnnfgmf
hpjqvppo
dshgwmgb
pzxeoymv
nlokvrio
cgcaxffl
dvimsnxu
iczcvwho
lkxumswj
satmovog
ujwknitl
halkgpaa
pnttnodc
adsvsumi
jwerfpko
yhsjqytk
vpevemez
yvjmltwj
vdoeippw
siouxait
ftrspdpx
hptwqlmz
haewgrft
watbdvqz
eiptzrvr
msvbioso
dnjeoucg
qixvmlem
mqquklfq
sszagakl
khfbexqb
uysydrlc
inawynse
whuonlhq
eshukapj
vtrepdxm
pgjjcisd
puiunlts
replddlv
emjyyhmd
aahwhond
laneyzsj
jnlkdpyb
sqxrctuo
wmmyybvl
ldyvqldz
bzbrsdjr
ekxwhzte
gnpqywzz
afsfbtte
ggkbrgds
dlawfrbp
opypolpc
cqpxcfgh
ynmtlgvl
slfmicyv
ooguwxjc
tewmtlty
wcdwansw
ktercyvw
qrgxrzne
wvbhflls
dpfjwbmm
uigmcaow
ejzhkxic
fbewvcoh
jxbtcmwn
ywiktjqn
rftnjqpp
yalixnnw
srdsiwgy
pdpdrynx
ioroheqp
vpvvnmad
tqksxfsp
snzxciua
nrhtoskm
crfvapzk
wndbcxvf
syffkzmv
nneibkaf
unuvhnli
ujhdjkvs
gmyqgvdr
jedfxwje
bcshopnu
xgiprhyv
onibkkoq
riguljez
yodzrfeu
ogbwakaa
ymrltbxa
ourmuhrx
yxwixtuv
ptnxdvdm
oskvgexz
fbigwiaw
xctckzmy
khwiyvmw
qbqbtxpr
kavzlngz
bbklqvzt
rwlzppbq
upirhhca
ezlaqdgo
ieuynchi
qmjtojzq
qrricseq
hxkrsfmw
nssfpnws
tiaziudb
rvskpahe
pplmppvi
jxpyidio
teudseap
aclyhavi
yqafhkyd
drjhcqgu
zvfcfbjc
sqfuuezn
gwtsupqk
czakgbiy
wknfzbyj
ooxwycji
wxymanlx
ewbtpqtl
jmwnxydh
ceqdllqb
jhdbejmt
mazzsanu
uypyqlvh
itnrzbie
miuegdjz
tqxeipin
kbareizb
jgjxrycy
epshhech
oicruxsz
ptxgidha
bmgnvjtr
qvwzlmgq
cvwtdffi
ibzasmru
jfenrbjd
nrkgwvcz
hlmghdgd
emhdaicl
wdwrzocv
spwjcrud
dsgilvqn
phvmafqk
iiihsfff
uvcqgtyc
doxkrzzw
hktdpsbv
evqojani
kzapomdx
ewtbrdtb
rgshzyxq
ltinzxld
cazrrlcu
irfxunbt
rmqcsbvm
gddexbsb
qladhkpd
xlvzpmab
wirftlbu
fxfqjubx
sgogtrcb
zlqxxwfy
djgtbihr
gslssgsu
wytydgje
vmovsmdh
ogyiuirh
mtfxzrrx
kcpfbemc
blreqhel
zjsjqqyh
ciqwtpvk
yjcinpaa
wxbxagui
aqbjqmig
ybaeuhew
mjzpnttv
mevjcrqp
fpmgzgco
gklesvof
jzfssvvx
aynfmwhl
euosbnhf
lcebcalt
kvsuuyyt
ltranzur
nlledtpz
vqdrgckr
yodxnjpt
uyznwnni
ckczwqkp
uxtjgoee
otdoyaxg
lbccbfgi
mhzjujrp
cekkthvf
fbvpuhog
nzfannep
rnnqusey
aiocsiyy
uvcbtfwr
bzqirxrg
qnmfgshq
inyevvbn
wswvhglx
huxqxwwb
fdutjnfq
adajhsjk
ahllesij
tcfawzgu
zfdgmtry
byznvpfp
duunxdad
kgadxmdf
ptfaovzv
uhuvlivs
xcoqrmeu
nnnlvmga
zwrbykek
lvpumidd
hieivrnt
vrwqsvci
npbplsvm
ougzcgty
rzvgzooo
iehafkto
rzspzjne
dzvvhvld
fgkmmfda
xjsnnlmd
igvjrsuk
narcempo
xrhoiugu
ghxbpomr
waxtcbcg
tmqgsejx
dobaxhel
mpzgjyww
ehyfvnaz
zxrdlajd
hfquyvok
aqxxdcqv
vjbukram
rjvttibk
pryxgzrd
hcqpxgee
qjgqvoal
wmbuvcty
zpgxmdiu
foequjps
lmdjwyfj
mhqudwzv
lrzkttsw
owyatnru
gwppbbfb
fvlkdsjk
pwhlvjtb
zgldiibp
sokjzgvq
kfourwqm
nfqoyvsz
hdiwmrhk
nnapsbht
blqjjtwy
aknoauti
uhgowkyx
uypyjorh
blfeioot
kzbukpxk
kfmbxgle
zmegahum
upjouzrg
tkedvzfy
bxwxuutn
rrwxobjp
jdujkhox
jkycewdx
ivlbibns
qjshodxf
bektjeou
wotjfgfl
rjrcfiug
aklhubjf
kwpnaezt
lsqvzdom
pxzvorct
vcxazyzs
xsszjsjq
ydgfsukl
gqxpcrla
rvsoxkhy
rschupcm
ivlpikxi
etrnyvkh
byzymjms
qagdcqww
sxnausxs
giuitchj
qgolehtg
keeskeyb"""

c = numpy.zeros((8,26))
for line in input.split("\n"):
    for i,ch in enumerate(line.strip()):
        c[i,ord(ch)-ord('a')] += 1
print("".join([chr(i+ord('a')) for i in numpy.argmax(c,axis=1)]))
print("".join([chr(i+ord('a')) for i in numpy.argmin(c,axis=1)]))
