from random import choice,randint a,b=list(map(int,input().split())) def hash(S): ANS=0 now=1 for i in range(len(S)): ANS=(ANS+ord(S[i])*now)%b now*=a return ANS S="a" h=hash(S) X="abcdefghijklmnopqrstuvwxyz" while True: T="" for i in range(randint(1,100)): T+=choice(X) if hash(T)==h: break print(S) print(T)