import sys
import time
import copy
import csv
import re
while True:import time
import copy
import csv
import re
#take string from stdin
s=sys.stdin.readline()
sss=[str(word).strip() for word in s.splitlines(False)]
s=sys.stdin.readline()
sss=[str(word).strip() for word in s.splitlines(False)]
#if string="Q" than exit
if sss[0]=='Q': break
try:
for ss in sss:
if sss[0]=='Q': break
try:
for ss in sss:
#modify string with regexp
pattern=re.compile('^(\d{6});( \d{6})$')
u=pattern.search(ss).groups()
try:
pattern=re.compile('^(\d{6});(
u=pattern.search(ss).groups()
try:
#my task
seq1,seq2=getSeq(u[0],u[1])
except:
stseq1=list()
trseq1=list()
#put results into stdoutseq1,seq2=getSeq(u[0],u[1])
except:
stseq1=list()
trseq1=list()
print(';'.join(str(j) for j in seq1) ,sep=';', end='\n', file=sys.stdout)
print(';'.join(str(j) for j in seq2) ,sep=';', end='\n', file=sys.stdout)