k,a,b = map(int,input().split(' '))
mas = []
hm = []
hmhm = []
for j in range(2):
  mas.append([])
  for i in range(3):
    mas[j].append(list(map(int,input().split(' '))))
aa = 0
bb = 0

hmhm.append((aa,bb))
if a != b:
  if ((a == 2 and b == 1) or
      (a == 3 and b == 2) or
      (a == 1 and b == 3)):
    aa += 1
  else:
    bb += 1
hm.append((a,b))
hmhm.append((aa,bb))

i = 0
while (i < k-1 and
       (mas[0][a-1][b-1],mas[1][a-1][b-1]) not in hm):
  t = mas[0][a-1][b-1]
  y = mas[1][a-1][b-1]
  a = t
  b = y
  if a != b:
    if ((a == 2 and b == 1) or
        (a == 3 and b == 2) or
        (a == 1 and b == 3)):
      aa += 1
    else:
      bb += 1
  hm.append((a,b))
  hmhm.append((aa,bb))
  i += 1

if i < k-1:
  i = hm.index((mas[0][a-1][b-1],mas[1][a-1][b-1]))
  print(i)
  print(' '.join((str(aa),str(bb))))
  aa += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][0]-hmhm[0 if i==0 else i][0])
  bb += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][1]-hmhm[0 if i==0 else i][1])
  print(' '.join((str(aa),str(bb))))
  aa += (hmhm[((k-i) % (len(hm)-i))+(0 if i==0 else 1) + (0 if ((k-i) % (len(hm)-i))==0 else i)][0] -
         hmhm[0 if i==0 else i][0])
  bb += (hmhm[((k-i) % (len(hm)-i))+(0 if i==0 else 1) + (0 if ((k-i) % (len(hm)-i))==0 else i)][1] -
         hmhm[0 if i==0 else i][1])
print(' '.join(map(str,hm)))
print(' '.join(map(str,hmhm)))
print(' '.join((str(aa),str(bb))))


k,a,b = map(int,input().split(' '))
mas = []
hm = []
hmhm = []
for j in range(2):
  mas.append([])
  for i in range(3):
    mas[j].append(list(map(int,input().split(' '))))
aa = 0
bb = 0

if a != b:
  if ((a == 2 and b == 1) or
      (a == 3 and b == 2) or
      (a == 1 and b == 3)):
    aa += 1
  else:
    bb += 1
hm.append((a,b))
hmhm.append((aa,bb))

i = 0
while (i < k-1 and
       (mas[0][a-1][b-1],mas[1][a-1][b-1]) not in hm):
  t = mas[0][a-1][b-1]
  y = mas[1][a-1][b-1]
  a = t
  b = y
  if a != b:
    if ((a == 2 and b == 1) or
        (a == 3 and b == 2) or
        (a == 1 and b == 3)):
      aa += 1
    else:
      bb += 1
  hm.append((a,b))
  hmhm.append((aa,bb))
  i += 1

if i < k-1:
  i = hm.index((mas[0][a-1][b-1],mas[1][a-1][b-1]))
##  print(i)
##  print(' '.join((str(aa),str(bb))))
  aa += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][0]-(0 if i==0 else hmhm[i-1][0]))
  bb += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][1]-(0 if i==0 else hmhm[i-1][1]))
##  print(' '.join((str(aa),str(bb))))
  aa += hmhm[((k-i) % (len(hm)-i)) + (0 if i==0 else i-1)][0] - (0 if i==0 else hmhm[i-1][0])
  bb += hmhm[((k-i) % (len(hm)-i)) + (0 if i==0 else i-1)][1] - (0 if i==0 else hmhm[i-1][1])
##print(' '.join(map(str,hm)))
##print(' '.join(map(str,hmhm)))
print(' '.join((str(aa),str(bb))))


k,a,b = map(int,input().split(' '))
mas=[]
for j in range(2):
  mas.append([])
  for i in range(3):
    mas[j].append(list(map(int,input().split(' '))))
##a -= 1
##b -= 1
aa = 0
bb = 0
if a != b:
    if a > b or (a==0 and b==2):
      aa += 1
    else:
      bb += 1
for i in range(k-1):
  t = mas[0][a-1][b-1]
  y = mas[1][a-1][b-1]
  a = t
  b = y
  if a != b:
    if a > b or (a==0 and b==2):
      aa += 1
    else:
      bb += 1
print(' '.join((str(aa),str(bb))))


k,a,b = map(int,input().split(' '))
mas=[]
for j in range(2):
  mas.append([])
  for i in range(3):
    mas[j].append(list(map(int,input().split(' '))))
aa = 0
bb = 0
if a != b:
    if ((a == 2 and b == 1) or
        (a == 3 and b == 2) or
        (a == 1 and b == 3)):
      aa += 1
    else:
      bb += 1
for i in range(k-1):
  t = mas[0][a-1][b-1]
  y = mas[1][a-1][b-1]
  a = t
  b = y
  if a != b:
    if ((a == 2 and b == 1) or
        (a == 3 and b == 2) or
        (a == 1 and b == 3)):
      aa += 1
    else:
      bb += 1
print(' '.join((str(aa),str(bb))))


k,a,b = map(int,input().split(' '))
mas=[]
for j in range(2):
  mas.append([])
  for i in range(3):
    mas[j].append(list(map(int,input().split(' '))))
##a -= 1
##b -= 1
aa = 0
bb = 0
if a != b:
    if (a > b and a != 3) or (a==1 and b==3):
      aa += 1
    else:
      bb += 1
for i in range(k-1):
  t = mas[0][a-1][b-1]
  y = mas[1][a-1][b-1]
  a = t
  b = y
  if a != b:
    if (a > b and a != 2) or (a==0 and b==2):
      aa += 1
    else:
      bb += 1
print(' '.join((str(aa),str(bb))))


k,a,b = map(int,input().split(' '))
mas = []
hm = []
hmhm = []
for j in range(2):
  mas.append([])
  for i in range(3):
    mas[j].append(list(map(int,input().split(' '))))
aa = 0
bb = 0

hmhm.append((aa,bb))
if a != b:
  if ((a == 2 and b == 1) or
      (a == 3 and b == 2) or
      (a == 1 and b == 3)):
    aa += 1
  else:
    bb += 1
hm.append((a,b))
hmhm.append((aa,bb))

i = 0
while (i < k-1 and
       (mas[0][a-1][b-1],mas[1][a-1][b-1]) not in hm):
  t = mas[0][a-1][b-1]
  y = mas[1][a-1][b-1]
  a = t
  b = y
  if a != b:
    if ((a == 2 and b == 1) or
        (a == 3 and b == 2) or
        (a == 1 and b == 3)):
      aa += 1
    else:
      bb += 1
  hm.append((a,b))
  hmhm.append((aa,bb))
  i += 1

if i < k-1:
  i = hm.index((mas[0][a-1][b-1],mas[1][a-1][b-1]))
##  print(i)
##  print(' '.join((str(aa),str(bb))))
  aa += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][0]-hmhm[0 if i==0 else i][0])
  bb += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][1]-hmhm[0 if i==0 else i][1])
##  print(' '.join((str(aa),str(bb))))
  aa += (hmhm[((k-i) % (len(hm)-i))+(0 if i==0 else 1) + (0 if ((k-i) % (len(hm)-i))==0 else i)][0] -
         hmhm[0 if i==0 else i][0])
  bb += (hmhm[((k-i) % (len(hm)-i))+(0 if i==0 else 1) + (0 if ((k-i) % (len(hm)-i))==0 else i)][1] -
         hmhm[0 if i==0 else i][1])
##print(' '.join(map(str,hm)))
##print(' '.join(map(str,hmhm)))
print(' '.join((str(aa),str(bb))))


k,a,b = map(int,input().split(' '))
mas = []
hm = []
hmhm = []
for j in range(2):
  mas.append([])
  for i in range(3):
    mas[j].append(list(map(int,input().split(' '))))
aa = 0
bb = 0

if a != b:
  if ((a == 2 and b == 1) or
      (a == 3 and b == 2) or
      (a == 1 and b == 3)):
    aa += 1
  else:
    bb += 1
hm.append((a,b))
hmhm.append((aa,bb))

i = 0
while (i < k-1 and
       (mas[0][a-1][b-1],mas[1][a-1][b-1]) not in hm):
  t = mas[0][a-1][b-1]
  y = mas[1][a-1][b-1]
  a = t
  b = y
  if a != b:
    if ((a == 2 and b == 1) or
        (a == 3 and b == 2) or
        (a == 1 and b == 3)):
      aa += 1
    else:
      bb += 1
  hm.append((a,b))
  hmhm.append((aa,bb))
  i += 1

if i < k-1:
  i = hm.index((mas[0][a-1][b-1],mas[1][a-1][b-1]))
##  print(i)
##  print(' '.join((str(aa),str(bb))))
  aa += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][0]-(0 if i==0 else hmhm[i-1][0]))
  bb += ((k-i) // (len(hm)-i) -1)*(hmhm[-1][1]-(0 if i==0 else hmhm[i-1][1]))
##  print(' '.join((str(aa),str(bb))))
  aa += hmhm[((k-i) % (len(hm)-i)) + i-1][0] - (0 if i==0 else hmhm[i-1][0])
  bb += hmhm[((k-i) % (len(hm)-i)) + i-1][1] - (0 if i==0 else hmhm[i-1][1])
##print(' '.join(map(str,hm)))
##print(' '.join(map(str,hmhm)))
print(' '.join((str(aa),str(bb))))


ka, kb = 0, 0

def g(a, b):
    global ka, kb
    if a == b:
        return
    if abs(a - b) == 2:
        if a == 1:
            ka += 1
        else:
            kb += 1
    else:
        if a > b:
            ka += 1
        else:
            kb += 1

def main():
    global ka, kb
    k, a, b = map(int, input().split())
    aa = [[] for i in [1, 1, 1]]
    bb = [[] for i in [1, 1, 1]]
    aa[0] = list(map(int, input().split()))
    aa[1] = list(map(int, input().split()))
    aa[2] = list(map(int, input().split()))
    bb[0] = list(map(int, input().split()))
    bb[1] = list(map(int, input().split()))
    bb[2] = list(map(int, input().split()))
    x = a
    y = b
    o = 1
    g(x, y)
    x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
    #print(x, y, ka, kb)
    while x != a or y != b:
        o += 1
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)
        if o == k:
            return
    ka *= k // o
    kb *= k // o
    o *= k // o
    while o != k:
        o += 1
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)

main()
print(ka, kb)


ka, kb = 0, 0

def g(a, b):
    global ka, kb
    if a == b:
        return
    if abs(a - b) == 2:
        if a == 1:
            ka += 1
        else:
            kb += 1
    else:
        if a > b:
            ka += 1
        else:
            kb += 1

def main():
    global ka, kb
    k, a, b = map(int, input().split())
    aa = [[] for i in [1, 1, 1]]
    bb = [[] for i in [1, 1, 1]]
    aa[0] = list(map(int, input().split()))
    aa[1] = list(map(int, input().split()))
    aa[2] = list(map(int, input().split()))
    bb[0] = list(map(int, input().split()))
    bb[1] = list(map(int, input().split()))
    bb[2] = list(map(int, input().split()))
    x = a
    y = b
    o = 1
    c = [[x, y]]
    d = [[0, 0]]
    g(x, y)
    x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
    #print(x, y, ka, kb)
    while [x, y] not in c:
        o += 1
        c += [[x, y]]
        d += [[ka, kb]]
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)
        if o == k:
            return
    ind = c.index([x, y])
    dka = ka - d[ind][0]
    dkb = kb - d[ind][1]
    delta = o - ind
    kk = (k - ind) // delta - 1
    #print(dka, dkb, delta)
    ka += kk * dka
    kb += kk * dkb
    o += kk * delta
    while o != k:
        o += 1
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)

main()
print(ka, kb)


ka, kb = 0, 0

def g(a, b):
    global ka, kb
    if a == b:
        return
    if abs(a - b) == 2:
        if a == 1:
            ka += 1
        else:
            kb += 1
    else:
        if a > b:
            ka += 1
        else:
            kb += 1

def main():
    global ka, kb
    k, a, b = map(int, input().split())
    aa = [[] for i in [1, 1, 1]]
    bb = [[] for i in [1, 1, 1]]
    aa[0] = list(map(int, input().split()))
    aa[1] = list(map(int, input().split()))
    aa[2] = list(map(int, input().split()))
    bb[0] = list(map(int, input().split()))
    bb[1] = list(map(int, input().split()))
    bb[2] = list(map(int, input().split()))
    x = a
    y = b
    o = 1
    c = [[x, y]]
    d = [[0, 0]]
    g(x, y)
    if o == 1:
        return
    x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
    #print(x, y, ka, kb)
    while [x, y] not in c:
        o += 1
        c += [[x, y]]
        d += [[ka, kb]]
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)
        if o == k:
            return
    ind = c.index([x, y])
    dka = ka - d[ind][0]
    dkb = kb - d[ind][1]
    delta = o - ind
    kk = (k - ind) // delta - 1
    #print(dka, dkb, delta)
    ka += kk * dka
    kb += kk * dkb
    o += kk * delta
    while o != k:
        o += 1
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)

main()
print(ka, kb)


ka, kb = 0, 0

def g(a, b):
    global ka, kb
    if a == b:
        return
    if abs(a - b) == 2:
        if a == 1:
            ka += 1
        else:
            kb += 1
    else:
        if a > b:
            ka += 1
        else:
            kb += 1

def main():
    global ka, kb
    k, a, b = map(int, input().split())
    aa = [[] for i in [1, 1, 1]]
    bb = [[] for i in [1, 1, 1]]
    aa[0] = list(map(int, input().split()))
    aa[1] = list(map(int, input().split()))
    aa[2] = list(map(int, input().split()))
    bb[0] = list(map(int, input().split()))
    bb[1] = list(map(int, input().split()))
    bb[2] = list(map(int, input().split()))
    x = a
    y = b
    o = 1
    c = [[x, y]]
    d = [[0, 0]]
    g(x, y)
    if k == 1:
        return
    x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
    #print(x, y, ka, kb)
    while [x, y] not in c:
        o += 1
        c += [[x, y]]
        d += [[ka, kb]]
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)
        if o == k:
            return
    ind = c.index([x, y])
    dka = ka - d[ind][0]
    dkb = kb - d[ind][1]
    delta = o - ind
    kk = (k - ind) // delta - 1
    #print(dka, dkb, delta)
    ka += kk * dka
    kb += kk * dkb
    o += kk * delta
    while o != k:
        o += 1
        g(x, y)
        x, y = aa[x - 1][y - 1], bb[x - 1][y - 1]
        #print(x, y, ka, kb)

main()
print(ka, kb)


#educational round 29
#two robots play N rounds of game 1 2 3. each choose a number from 1 2 or 3
#game rule 3 win 2, 2 win 1, 1 win against 3
#player choose next number from previous move of both players.
#input format
#line 1:     N a b - N round of games, a b is the number of first round from alice and bob
#line 2 - 4: 3 x 3 grid Aij is next number of Alice if previous A=i, B=j
#line 5 - 7: 3 x 3 grid Bij is next number of Bob if previous A=i, B=j
#output format
#total points of Alice and Bob
class Game123:
    def __init__(self):
        self.alice = [0]*9
        self.bob=[0]*9
        self.moves=[-1]*10
        self.count=0
        self.pointsA=0
        self.pointsB=0

    #convert 3x3 grid into 1D array
    def gameChoice(self, m, r, bBob):
        choice=self.alice
        if bBob:
            choice=self.bob
        for i in range(len(m)):
            choice[3*r+i]=m[i]

    #look if move already exists
    def findMove(self, a, b):
        m=(a-1)*3+b-1
        for i in range(self.count):
            if self.moves[i]==m:
                return i
        #print("a={0} b={1} m={2} count={3}".format(a,b,m, self.count))
        self.moves[self.count]=m
        self.count += 1
        return -1

    def computePoints(self, m):
        #convert m back to a and b, m is  from 0 to 8
        b=m%3+1
        a=m//3+1
        #return positive if alice win
        if a==b:
            return
        if a==3 and b==2 or a==2 and b==1 or a==1 and b==3:
            self.pointsA += 1
        else:
            self.pointsB += 1

    def output(self):
        print("{0} {1}".format(self.pointsA,self.pointsB))

    def startGame(self, a, b, totalmoves):
        #print(self.moves)
        #print(self.alice)
        #print(self.bob)
        found=-1
        while found<0:
            found=self.findMove(a,b)
            m=(a-1)*3+b-1
            a=self.alice[m]  #next move
            b=self.bob[m]
        #print("repeat {0} to {1}".format(found, self.count))
        pointaA=0
        pointsB=0
        # compute moves of no repeats
        if totalmoves <= self.count:
            for i in range(totalmoves):
                self.computePoints(self.moves[i])
        else:
            totalmoves -= found
            repeats = totalmoves//(self.count-found)
            totalmoves %= (self.count-found)
            for i in range(found, self.count): #repeated moves
                self.computePoints(self.moves[i])
            #self.output()
            self.pointsA *= repeats
            self.pointsB *= repeats
            #self.output()
            for i in range(found): #moves before repeat
                self.computePoints(self.moves[i])
            #self.output()
            for i in range(found, totalmoves+found): #odd moves after repeat
                self.computePoints(self.moves[i])
        self.output()

    def test():
        g=Game123()
        g.gameChoice([2,2,1],0,False)
        g.gameChoice([3,3,1],1,False)
        g.gameChoice([3,1,3],2,False)
        g.gameChoice([1,1,1],0,True)
        g.gameChoice([2,1,1],1,True)
        g.gameChoice([1,2,3],2,True)
        g.startGame(1,1,8)

def nia():
    s=input()
    while len(s)==0:
        s=input()
    s=s.split()
    iVal=[];
    for i in range (len(s)):
        iVal.append(int(s[i]))
    return iVal

def solve():
    g=Game123()
    nab=nia()
    for i in range(3):
        g.gameChoice(nia(), i, False)
    for i in range(3):
        g.gameChoice(nia(), i, True)
    g.startGame(nab[1],nab[2],nab[0])

solve()


f = lambda: list(map(int, input().split()))
g = lambda: [[0] * 4] + [[0] + f() for i in range(3)]
h = lambda x, y: x - 1 == y % 3

k, a, b = f()
A, B = g(), g()
u = v = 0
s, d = k // 9, k % 9

for i in range(9):
    u += h(a, b)
    v += h(b, a)
    a, b = A[a][b], B[a][b]

u, v = s * u, s * v

for j in range(d):
    u += h(a, b)
    v += h(b, a)
    a, b = A[a][b], B[a][b]

print(u, v)


f = lambda: list(map(int, input().split()))
g = lambda: [[0] * 4] + [[0] + f() for i in range(3)]
h = lambda x, y: x - 1 == y % 3
t = lambda a, b, u, v: (A[a][b], B[a][b], u + h(a, b), v + h(b, a))
k, a, b = f()
s, d = k // 2520, k % 2520
if s: s, d = s - 1, d + 2520
A, B = g(), g()
u = v = x = y = 0
for j in range(d): a, b, u, v = t(a, b, u, v)
for i in range(9): a, b, x, y = t(a, b, x, y)
print(u + x * s, v + y * s)


f = lambda: list(map(int, input().split()))
g = lambda: [[0] * 4] + [[0] + f() for i in range(3)]
h = lambda x, y: x - 1 == y % 3

k, a, b = f()
A, B = g(), g()
u = v = 0

for i in range(k):
    u += h(a, b)
    v += h(b, a)
    a, b = A[a][b], B[a][b]

print(u, v)


f = lambda: list(map(int, input().split()))
g = lambda: [[0] * 4] + [[0] + f() for i in range(3)]
h = lambda x, y: x - 1 == y % 3

k, a, b = f()
A, B = g(), g()
u = v = 0
s, d = k // 9, k % 9

for i in range(9):
    u += h(a, b)
    v += h(b, a)
    a, b = A[a][b], B[a][b]

u = 9 * s * u
v = 9 * s * v

for j in range(d):
    u += h(a, b)
    v += h(b, a)
    a, b = A[a][b], B[a][b]

print(u, v)


f = lambda: list(map(int, input().split()))
g = lambda: [[0] * 4] + [[0] + f() for i in range(3)]
h = lambda x, y: x - 1 == y % 3
t = lambda a, b, u, v: (A[a][b], B[a][b], u + h(a, b), v + h(b, a))
k, a, b = f()
s, d = (k - 1) // 9, (k - 1) % 9
A, B = g(), g()
u = v = x = y = 0
a, b, u, v = t(a, b, u, v)
for j in range(d): a, b, u, v = t(a, b, u, v)
for i in range(9): a, b, x, y = t(a, b, x, y)
print(u + x * s, v + y * s)


f = lambda: list(map(int, input().split()))
g = lambda: [[0] * 4] + [[0] + f() for i in range(3)]
h = lambda x, y: x - 1 == y % 3
t = lambda a, b, u, v: (A[a][b], B[a][b], u + h(a, b), v + h(b, a))
k, a, b = f()
p = 2520
s, d = k // p, k % p
if s: s, d = s - 1, d + p
A, B = g(), g()
u = v = x = y = 0
for j in range(d): a, b, u, v = t(a, b, u, v)
for i in range(p): a, b, x, y = t(a, b, x, y)
print(u + x * s, v + y * s)


import itertools

n = int(input())
a, b = input()
c, d = input()
right_pattern = ()
long_patterns = list(itertools.permutations(['a', 'b', 'c', 'a', 'b', 'c']))
short_patterns = list(itertools.permutations(['a', 'b', 'c']))
if n >= 2:
    for i in long_patterns:
        right = True
        for j in range(len(i) - 1):
            if i[j:(j+2)] == [a,b] or i[j:j+2] == [c,d]:
                right = False
        if right:
                right_pattern = i
else:
    for i in short_patterns:
        right = True
        if i[0:2] == (a,b) or i[1:] == (c,d) or i[1:] == (a,b) or i[0:2] == (c,d):
                right = False
        if right:
            right_pattern = i
if right_pattern != ():
    print('YES')
    for i in range(n*3):
        print(right_pattern[i % len(right_pattern)], end='')
    print()
else:
    print('NO')


import itertools

n = int(input())
a, b = input()
c, d = input()
right_pattern = ()
long_patterns = list(itertools.permutations(['a', 'b', 'c', 'a', 'b', 'c']))
short_patterns = list(itertools.permutations(['a', 'b', 'c']))
if n >= 2:
    for i in long_patterns:
        right = True
        for j in range(len(i) - 1):
            if i[j:(j+2)] == [a,b] or i[j:j+2] == [c,d]:
                right = False
        if right:
                right_pattern = i
else:
    for i in short_patterns:
        right = True
        if i[0:2] == (a,b) or i[1:] == (c,d) or i[1:] == (a,b) or i[0:2] == (c,d):
                right = False
        if right:
            right_pattern = i
for i in range(n*3):
    print(right_pattern[i % len(right_pattern)], end='')
print()


import itertools

n = int(input())
a, b = input()
c, d = input()
right_pattern = ()
long_patterns = list(itertools.permutations(['a', 'b', 'c', 'a', 'b', 'c']))
short_patterns = list(itertools.permutations(['a', 'b', 'c']))
if n >= 2:
    for i in long_patterns:
        right = True
        for j in range(len(i) - 1):
            if (i[j], i[j+1]) == (a,b) or (i[j],i[j+1]) == (c,d):
                right = False
        if right:
                right_pattern = i
else:
    for i in short_patterns:
        right = True
        if i[0:2] == (a,b) or i[1:] == (c,d) or i[1:] == (a,b) or i[0:2] == (c,d):
                right = False
        if right:
            right_pattern = i
if right_pattern != ():
    print('YES')
    for i in range(n*3):
        print(right_pattern[i % len(right_pattern)], end='')
    print()
else:
    print('NO')


import itertools

n = int(input())
a, b = input()
c, d = input()
right_pattern = ()
short_patterns = list(itertools.permutations(['a', 'b', 'c']))
if n >= 2:
    for i in short_patterns:
        i += i
        right = True
        for j in range(len(i) - 1):
            if (i[j], i[j+1]) == (a,b) or (i[j],i[j+1]) == (c,d):
                right = False
        if right:
                right_pattern = i
else:
    for i in short_patterns:
        right = True
        if i[0:2] == (a,b) or i[1:] == (c,d) or i[1:] == (a,b) or i[0:2] == (c,d):
                right = False
        if right:
            right_pattern = i
if right_pattern != ():
    print('YES')
    for i in range(n*3):
        print(right_pattern[i % len(right_pattern)], end='')
    print()
else:
    faith = False
    for i in short_patterns:
        right = True
        if i[0:2] == (a, b) or i[1:] == (c, d) or i[1:] == (a, b) or i[0:2] == (c, d):
            right = False
        if right:
            right_pattern = i
            faith = True
    if faith:
        print('YES')
        for i in right_pattern:
            print(*[i for _ in range(n)],sep='',end='')
    else:
        print('NO')


def good(s, t, r):
    for i in range(len(s) - 1):
        pa = s[i:i + 2]
        if pa == t or pa == r:
            return False
    return True
n = int(input())
s = input()
t = input()
l = ['abc'*n, 'acb'*n, 'bac'*n, 'bca'*n, 'cab'*n, 'cba'*n]
l.append('a'*n + 'b'*n + 'c'*n)
l.append('a'*n + 'c'*n + 'b'*n)
l.append('b'*n + 'a'*n + 'c'*n)
l.append('b'*n + 'c'*n + 'a'*n)
l.append('c'*n + 'a'*n + 'b'*n)
l.append('c'*n + 'b'*n + 'a'*n)
print('YES')
for x in l:
    if(good(x, s, t)):
        print(x)
        exit()


n = int(input())
f1, f2 = input(), input()

variants = {'abc', 'acb', 'bac', 'bca', 'cab', 'cba'}
for variant in variants:
    if f1 not in variant and f2 not in variant:
        res = ''
        if f1[0] == f1[1] and f2[0] == f2[1]:
            res = (variant[0] + variant[1] + variant[2]) * n
        elif f1[0] == f1[1] or f2[0] == f2[1]:
            res = (variant[0] + variant[1] + variant[2]) * n
        else:
            res = variant[0] * n + variant[1] * n + variant[2] * n

        if f1 not in res and f2 not in res:
            print('YES')
            print(res)
            exit()
print('NO')


n = int(input())
f1, f2 = input(), input()

variants = {'abc', 'acb', 'bac', 'bca', 'cab', 'cba'}
for variant in variants:
    if f1 not in variant and f2 not in variant:
        print('YES')
        if f1[0] == f1[1] or f2[0] == f2[1]:
            print((variant[0] + variant[1] + variant[2]) * n)
        else:
            print(variant[0] * n + variant[1] * n + variant[2] * n)
        exit()
print('NO')


n = int(input())
f1, f2 = input(), input()

variants = {'abca', 'acba', 'bacb', 'bcab', 'cabc', 'cbac'}
for variant in variants:
    if f1 not in variant and f2 not in variant:
        print('YES')
        if f1[0] == f1[1] or f2[0] == f2[1]:
            print((variant[0] + variant[1] + variant[2]) * n)
        else:
            print(variant[0] * n + variant[1] * n + variant[2] * n)
        exit()
print('NO')


n = int(input())
f1, f2 = input(), input()

variants = {'abc', 'acb', 'bac', 'bca', 'cab', 'cba'}
for variant in variants:
    if f1 not in variant and f2 not in variant:
        print('YES')
        if f1[0] == f1[1] and f2[0] == f2[1]:
            print((variant[0] + variant[1] + variant[2]) * n)
        elif f1[0] == f1[1] or f2[0] == f2[1]:
            print((variant[0] + variant[1] + variant[2]) * n)
        else:
            print(variant[0] * n + variant[1] * n + variant[2] * n)
        exit()
print('NO')


n = int(input())
f1, f2 = input(), input()

letters = {'a', 'b', 'c'}
if f1[0] == f2[0]:
    letters.remove(f1[0])
    letters = list(letters)
    print(letters[0] * n + letters[1] * n + f1[0] * n)
    exit()

if f1[0] != f1[1] and f2[0] != f2[1]:
    variants = {'abc', 'acb', 'bac', 'bca', 'cab', 'cba'}
    for variant in variants:
        if f1 not in variant and f2 not in variant:
            print('YES')
            print(variant[0] * n + variant[1] * n + variant[2] * n)
            exit()

if f1[0] == f1[1] or f2[0] == f2[1]:
    variants = {'abc', 'acb', 'bac', 'bca', 'cab', 'cba'}
    for variant in variants:
        if f1 not in variant and f2 not in variant:
            print('YES')
            print((variant[0] + variant[1] + variant[2]) * n)
            exit()

print('NO')


n = int(input())
l = ['abc'*n  , 'acb'*n , 'bca'*n , 'cab'*n , 'bca'*n , 'cba'*n , 'b'*n+'c'*n+'a'*n,'a'*n+'b'*n+'c'*n , 'c'*n+'a'*n+'b'*n]
a = input()
b = input()
for i in l:
    if a not in i and b not in i:
        print(i)
        break


n = int(input())
l = ['abc'*n  , 'acb'*n , 'bca'*n , 'cab'*n , 'bca'*n , 'cba'*n , 'b'*n+'c'*n+'a'*n,'a'*n+'b'*n+'c'*n , 'c'*n+'a'*n+'b'*n]
a = input()
b = input()
print("YES")
for i in l:
    if a not in i and b not in i:
        print(i)
        break


n=int(input())
a=input()
b=input()
arr=["abc", "bca", "cab", "acb", "cba", "bac"]
for i in arr:
    x=i+i[0]
    if x.count(a)==0 and x.count(b)==0:
        print("YES")
        print(n*i)
        exit()
for i in arr:
    if i[0:2].count(a)==0 and i[0:2].count(b)==0 and i[1:].count(a)==0 and i[1:].count(b)==0:
        print("YES")
        print(n*i[0]+n*i[1]+n*i[2])
        exit()
print("NO")


n=int(input())
s=input()
t=input()
if n>=2:
	l=["abcabc","acbacb","bacbac","bcabca","cabcab","cbacba","aabbcc","bbccaa","ccaabb","aaccbb","bbaacc","ccbbaa"]
	for i in l:
		string = ""
		if s in i or t in i:
			continue
		else:
			string = i
			break
	#print (string)
	if string=="":
		print ("NO")
	else:
		if string not in ["aabbcc","bbccaa","ccaabb","aaccbb","bbaacc","ccbbaa"]:
			temp=string[0:3]
			print ("YES")
			print (temp*n)
		else:
			first = string[0]
			second = string[2]
			third = string[4]
			print ("YES")
			print (first*n+second*n+third*n)
else:
	l=["abc","acb","bac","bca","cab","cba"]
	for i in l:
		string=""
		if s in i or t in i:
			continue
		else:
			string = i
			break
	if string=="":
		print ("NO")
	else:
		print ("YES")
		print (string)


n=int(input())
s=input()
t=input()
if n>=2:
	l=["abcabc","acbacb","bacbac","bcabca","cabcab","cbacba","aabbcc"]
	for i in l:
		string = ""
		if s in i or t in i:
			continue
		else:
			string = i
			break
	if string=="":
		print ("NO")
	else:
		if string != "aabbcc":
			temp=string[0:3]
			print ("YES")
			print (temp*n)
		else:
			print ("YES")
			print ("a"*n+"b"*n+"c"*n)
else:
	l=["abc","acb","bac","bca","cab","cba"]
	for i in l:
		string=""
		if s in i or t in i:
			continue
		else:
			string = i
			break
	if string=="":
		print ("NO")
	else:
		print ("YES")
		print (string)


n=int(input())
s=input()
t=input()
if n>=2:
	l=["abcabc","acbacb","bacbac","bcabca","cabcab","cbacba","aabbcc","bbccaa","ccaabb","aaccbb","bbaacc","ccbbaa"]
	for i in l:
		string = ""
		if s in i or t in i:
			continue
		else:
			string = i
			break
	#print (string)
	if string=="":
		print ("NO")
	else:
		if string not in ["aabbcc","bbccaa","ccaabb","aaccbb","bbaacc","ccbbaa"]:
			temp=string[0:3]
			print ("YES")
			print (temp*n)
		else:
			print ("YES")
			print ("a"*n+"b"*n+"c"*n)
else:
	l=["abc","acb","bac","bca","cab","cba"]
	for i in l:
		string=""
		if s in i or t in i:
			continue
		else:
			string = i
			break
	if string=="":
		print ("NO")
	else:
		print ("YES")
		print (string)


from sys import stdin
from sys import setrecursionlimit as SRL; SRL(10**7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

g = ['a','b','c']

n = int(rd())

s = str(rd().strip())
t = str(rd().strip())
ans = ''

def find():
    ct = [s,t]
    for i in range(3):
        for j in range(3):
            if j!=i:
                for k in range(3):
                    if k!=i and k!=j:
                        if g[i]+g[j] not in ct and g[j]+g[k] not in ct and g[k]+g[i] not in ct:
                            return g[i]+g[j]+g[k]

if s == t:
    ans = find()*n

elif s[0] == t[0]:
    for i in g:
        if i!=s[1] and i!=t[1]:
            if i == s[0]:
                ans = s[1]*n+t[1]*n+i*n
            else:
                ans = find()*n

elif s[1] == t[1]:
    for i in g:
        if i!=s[0] and i != t[0]:
            if i == s[1]:
                ans = i*n + s[0]*n+t[0]*n
            else:
                ans = find()*n

elif s == t[::-1]:
    for i in g:
        if i!=s[0] and i!=s[1]:
            ans = s[0]*n+i*n+s[1]*n
else:
    ans = find()*n

print("YES")
print(ans)


from sys import stdin
from sys import setrecursionlimit as SRL; SRL(10**7)
rd = stdin.readline
rrd = lambda: map(int, rd().strip().split())

g = ['a','b','c']

n = int(rd())

s = str(rd().strip())
t = str(rd().strip())
ans = ''

def find():
    ct = [s,t]
    for i in range(3):
        for j in range(3):
            if j!=i:
                for k in range(3):
                    if k!=i and k!=j:
                        if g[i]+g[j] not in ct and g[j]+g[k] not in ct and g[k]+g[i] not in ct:
                            return g[i]+g[j]+g[k]

if s == t:
    ans = find()*n

elif s[0] == t[0]:
    for i in g:
        if i!=s[1] and i!=t[1]:
            if i == s[0]:
                ans = s[1]*n+t[1]*n+i*n
            else:
                ans = find()*n

elif s[1] == t[1]:
    for i in g:
        if i!=s[0] and i != t[0]:
            if i == s[1]:
                ans = i*n + s[0]*n+t[0]*n
            else:
                ans = find()*n

else:
    ans = find()*n

print("YES")
print(ans)


n = int(input())
s = input()
t = input()
print('YES')
if ((s == 'aa' and t == 'bb' or t == 'aa') and s == 'bb' or (s == 'aa' and t == 'cc' or t == 'aa') and s == 'cc' or
    (s == 'bb' and t == 'cc') or t == 'bb' and s == 'cc'):
    print(n * 'abc')
elif (s == 'aa' or s == 'bb' or s == 'cc') and t == 'ab' or (t == 'aa' or t == 'bb' or t == 'cc') and s == 'ab':
    print(n * 'bac')
elif (s == 'aa' or s == 'bb' or s == 'cc') and t == 'ac' or (t == 'aa' or t == 'bb' or t == 'cc') and s == 'ac':
    print(n * 'cab')
elif (s == 'aa' or s == 'bb' or s == 'cc') and t == 'bc' or (t == 'aa' or t == 'bb' or t == 'cc') and s == 'bc':
    print(n * 'bac')
elif (s == 'aa' or s == 'bb' or s == 'cc') and t == 'ba' or (t == 'aa' or t == 'bb' or t == 'cc') and s == 'ba':
    print(n * 'abc')
elif (s == 'aa' or s == 'bb' or s == 'cc') and t == 'ca' or (t == 'aa' or t == 'bb' or t == 'cc') and s == 'ca':
    print(n * 'acb')
elif (s == 'aa' or s == 'bb' or s == 'cc') and t == 'cb' or (t == 'aa' or t == 'bb' or t == 'cc') and s == 'cb':
    print(n * 'cab')

elif s == 'ab' and t == 'bc' or t == 'ab' and s == 'bc':
    print('b' * n + 'a' * n + 'c' * n)
elif s == 'ab' and t == 'ac' or t == 'ab' and s == 'ac':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ab' and t == 'ab' or t == 'ab' and s == 'ab':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ab' and t == 'ba' or t == 'ab' and s == 'ba':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ab' and t == 'ca' or t == 'ab' and s == 'ca':
    print('c' * n + 'b' * n + 'a' * n)
elif s == 'ab' and t == 'cb' or t == 'ab' and s == 'cb':
    print('b' * n + 'c' * n + 'a' * n)

elif s == 'ac' and t == 'cb' or t == 'ac' and s == 'cb':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ac' and t == 'ca' or t == 'ac' and s == 'ca':
    print('a' * n + 'b' * n + 'c' * n)
elif s == 'ac' and t == 'ab' or t == 'ac' and s == 'ab':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ac' and t == 'ac' or t == 'ac' and s == 'ac':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ac' and t == 'ba' or t == 'ac' and s == 'ba':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ac' and t == 'bc' or t == 'ac' and s == 'bc':
    print('c' * n + 'a' * n + 'b' * n)

elif s == 'ba' and t == 'ac' or t == 'ba' and s == 'ac':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ba' and t == 'ab' or t == 'ba' and s == 'ab':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ba' and t == 'ba' or t == 'ba' and s == 'ba':
    print('b' * n + 'c' * n + 'a' * n)
elif s == 'ba' and t == 'bc' or t == 'ba' and s == 'bc':
    print('c' * n + 'a' * n + 'b' * n)
elif s == 'ba' and t == 'ca' or t == 'ba' and s == 'ca':
    print('a' * n + 'b' * n + 'c' * n)
elif s == 'ba' and t == 'cb' or t == 'ba' and s == 'cb':
    print('b' * n + 'c' * n + 'a' * n)

elif s == 'bc' and t == 'ac' or t == 'bc' and s == 'ac':
    print('c' * n + 'a' * n + 'b' * n)
elif s == 'bc' and t == 'ab' or t == 'bc' and s == 'ab':
    print('b' * n + 'a' * n + 'c' * n)
elif s == 'bc' and t == 'ba' or t == 'bc' and s == 'ba':
    print('c' * n + 'a' * n + 'b' * n)
elif s == 'bc' and t == 'bc' or t == 'bc' and s == 'bc':
    print('c' * n + 'a' * n + 'b' * n)
elif s == 'bc' and t == 'ca' or t == 'bc' and s == 'ca':
    print('b' * n + 'a' * n + 'c' * n)
elif s == 'bc' and t == 'cb' or t == 'bc' and s == 'cb':
    print('b' * n + 'a' * n + 'c' * n)

elif s == 'ca' and t == 'ac' or t == 'ca' and s == 'ac':
    print('a' * n + 'b' * n + 'c' * n)
elif s == 'ca' and t == 'ab' or t == 'ca' and s == 'ab':
    print('b' * n + 'a' * n + 'c' * n)
elif s == 'ca' and t == 'ba' or t == 'ca' and s == 'ba':
    print('a' * n + 'c' * n + 'b' * n)
elif s == 'ca' and t == 'bc' or t == 'ca' and s == 'bc':
    print('a' * n + 'c' * n + 'b' * n)
elif s == 'ca' and t == 'ca' or t == 'ca' and s == 'ca':
    print('b' * n + 'a' * n + 'c' * n)
elif s == 'ca' and t == 'cb' or t == 'ca' and s == 'cb':
    print('b' * n + 'a' * n + 'c' * n)
else:
    print('abc' * n)


BASES = {"ab":"acb", "ac":"abc", "ba":"abc", "bc":"acb", "ca":"acb", "cb":"abc"}

def main():
    n = int(input())
    s = input()
    t = input()
    print("YES")
    print(solve(n, s, t))

def solve(n, s, t):
    if s[0] == s[1]:
        if t[0] == t[1]:
            base = "abc"
        else:
            base = BASES[t]
        return base * n
    else:
        base = BASES[s]
        if t[0] == t[1]:
            return base * n
        elif t[0] == s[0] and t[1] != s[1]:
            return s[1] * n + t[1] * n + s[0] * n
        elif t[1] == s[1] and t[0] != s[0]:
            return s[1] * n + s[0] * n + t[0] * n
        elif t[0] == s[1] and t[1] == s[0]:
            letters = ["a", "b", "c"]
            letters.remove(s[0])
            letters.remove(s[1])
            base = s[0] + letters[0] + s[1]
            baser = s[1] + letters[0] + s[0]
            return (base + baser) * (n // 2) + base * (n % 2)
        else:
            return base * n

if __name__ == "__main__":
    main()


BASES = {"ab":"acb", "ac":"abc", "ba":"abc", "bc":"acb", "ca":"abc", "cb":"abc"}

def main():
    n = int(input())
    s = input()
    t = input()
    print("YES")
    if s[0] == s[1]:
        if t[0] == t[1]:
            base = "abc"
        else:
            base = BASES[t]
        print(base*n)
    else:
        base = BASES[s]
        if t[0] == t[1]:
            print(base*n)
        elif t[0] == s[0] and t[1] != s[1]:
            print(s[1]*n+t[1]*n+s[0]*n)
        elif t[1] == s[1] and t[0] != s[0]:
            print(s[1]*n+s[0]*n+t[0]*n)
        elif t[0] == s[1] and t[1] == s[0]:
            base2 = base + "".join(list(reversed(base)))
            print(base2*(n//2)+base*(n%2))
        else:
            print(base*n)

if __name__ == "__main__":
    main()


n = int(input())

s = input()
t = input()

print('YES')

if s not in 'abca' and t not in 'abca':
    print('abc' * n)
elif s not in 'acba' and t not in 'acba':
    print('acb' * n)
else:
    lastChar = 'a'
    if 'b' not in s:
        lastChar = 'b'
    elif 'c' not in s:
        lastChar = 'c'
    answer = s[1] * n + lastChar * n + s[0] * n
    print(answer)


import random
from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    if n == 2:
        return cases[0]
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i
        flag[0] = 1

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        if x == 2:
            j = i
        else:
            j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k
        flag[0] = 1

def do(begin, x, y):
    choose = random.randrange(0, 3)
    new = begin[choose]
    begin = begin[:choose] + begin[choose + 1:]
    while len(new) < len(start):
        position = random.randrange(0, len(begin))
        #print(position, begin[position])
        new = new + begin[position:position + 1]
        begin = begin[:position] + begin[position + 1:]
        #print(new, begin)
        if x in new or y in new:
            return ''
        elif len(new) == len(start):
            flag[0] = 1
            return new
        #time.sleep(0.1)

flag = [0]
if n == 1:
    while flag[0] == 0:
        start = 'abc'
        result = do(start, s, t)
    print('YES')
    print(result)

elif n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(solution)


from itertools import permutations

n = input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    if n == 2:
        return cases[0]
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i
        #flag[0] = 1

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        if x == 2:
            j = i
        else:
            j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k
        #flag[0] = 1

flag = [0]
if s[0] == t[0] and s[1] != t[1] and s[0] != s[1] and t[0] != t[1]:
    print('YES')
    print(n * s[1] + n * t[1] + n * s[0])
elif s[1] == t[1] and s[0] != t[0] and s[1] != s[0] and t[1] != t[0]:
    print('YES')
    print(n * s[1] + n * t[0] + n * s[0])
elif n == 1:
    options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
    for i in options:
        if s not in i and t not in i:
            print('YES')
            print(i)
            break

elif n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(solution)


from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    if n == 2:
        return cases[0]
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i
        #flag[0] = 1

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        if x == 2:
            j = i
        else:
            j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k
        #flag[0] = 1

flag = [0]
if s[0] == t[0] and s[1] != t[1] and s[0] != s[1] and t[0] != t[1]:
    print('YES')
    print(n * s[1] + n * t[1] + n * s[0])
elif s[1] == t[1] and s[0] != t[0] and s[1] != s[0] and t[1] != t[0]:
    print('YES')
    print(n * s[1] + n * t[0] + n * s[0])
elif n == 1:
    options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
    for i in options:
        if s not in i and t not in i:
            print('YES')
            print(i)
            break

elif n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(solution)


import random
from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

# print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    # print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    # print(filePerms)
    # print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    # print(filePerms)
    cases = []
    # print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    # print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    # print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    # print(filePerms)
    # print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    # print(filePerms)
    cases = []
    # print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    # print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    # print()
                    # print(k)
                    # print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    # print()
                    # print(i)
                    # print(k)
                    return int(x / 2) * i + k

if n % 2 == 0:
    solution = doEven(n, s, t)
    # print()
    # print(n, s, t)
    print('YES')
    print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    # print()
    # print(n, s, t)
    print('YES')
    print(solution)


from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    if n == 2:
        return cases[0]
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i
        flag[0] = 1

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        if x == 2:
            j = i
        else:
            j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k
        flag[0] = 1

flag = [0]
if s[0] == t[0] and s[1] != t[1] and s[0] != t[1]:
    print('YES')
    print(n * s[1] + n * t[1] + n * s[0])
elif s[1] == t[1] and s[0] != t[0] and s[1] != t[0]:
    print('YES')
    print(n * s[1] + n * t[0] + n * s[0])
elif n == 1:
    options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
    for i in options:
        if s not in i and t not in i:
            print('YES')
            print(i)
            break

elif n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(solution)


from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k

if n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    print('YES')
    print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    print('YES')
    print(solution)


from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

# print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    # print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    # print(filePerms)
    # print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    # print(filePerms)
    cases = []
    # print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    # print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    # print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    # print(filePerms)
    # print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    # print(filePerms)
    cases = []
    # print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    # print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    # print()
                    # print(k)
                    # print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    # print()
                    # print(i)
                    # print(k)
                    return int(x / 2) * i + k

if n % 2 == 0:
    solution = doEven(n, s, t)
    # print()
    # print(n, s, t)
    print('YES')
    print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    # print()
    # print(n, s, t)
    print('YES')
    print(solution)


    from itertools import permutations

    n = int(input().strip())
    s = input().strip()
    t = input().strip()

    #print(n, s, t)

    def doEven(n, s, t):
        d = ['a', 'a', 'b', 'b', 'c', 'c']
        #print(d)
        filePerms = []
        for i in permutations(d):
            if i not in filePerms:
                filePerms.append(i)
        #print(filePerms)
        #print(len(filePerms))

        for i in range(len(filePerms)):
            filePerms[i] = ''.join(filePerms[i])
        #print(filePerms)
        cases = []
        #print(s, t)
        for i in filePerms:
            if s not in i and t not in i:
                cases.append(i)
        #print(cases)
        for i in cases:
            j = i + i
            if s not in j and t not in j and n % 2 == 0:
                return i

    def doOdd(x, s, t):
        d = ['a', 'a', 'b', 'b', 'c', 'c']
        #print(d)
        filePerms = []
        for i in permutations(d):
            if i not in filePerms:
                filePerms.append(i)
        #print(filePerms)
        #print(len(filePerms))

        for i in range(len(filePerms)):
            filePerms[i] = ''.join(filePerms[i])
        #print(filePerms)
        cases = []
        #print(s, t)
        for i in filePerms:
            if s not in i and t not in i:
                cases.append(i)
        #print(cases)
        for i in cases:
            j = i + i
            if s not in j and t not in j:
                options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
                for k in options:
                    possible = k + i
                    if s not in possible and t not in possible:
                        #print()
                        #print(k)
                        #print(i)
                        return k + int(x / 2) * i
                for k in options:
                    possible = i + k
                    if s not in possible and t not in possible:
                        #print()
                        #print(i)
                        #print(k)
                        return int(x / 2) * i + k

    if n % 2 == 0:
        solution = doEven(n, s, t)
        #print()
        #print(n, s, t)
        print('YES')
        print(int(n / 2) * solution)
    else:
        solution = doOdd(n - 1, s, t)
        #print()
        #print(n, s, t)
        print('YES')
        print(solution)


from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    if n == 2:
        return cases[0]
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i
        flag[0] = 1

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        if x == 2:
            j = i
        else:
            j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k
        flag[0] = 1

flag = [0]
if n == 1:
    options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
    for i in options:
        if s not in i and t not in i:
            print('YES')
            print(i)
            break

elif n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(solution)


from itertools import permutations

n = int(input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    if n == 2:
        return cases[0]
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i
        flag[0] = 1

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        if x == 2:
            j = i
        else:
            j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k
        flag[0] = 1

flag = [0]
if s[0] == t[0] and s[1] != t[1] and s[0] != s[1] and t[0] != t[1]:
    print('YES')
    print(n * s[1] + n * t[1] + n * s[0])
elif s[1] == t[1] and s[0] != t[0] and s[1] != s[0] and t[1] != t[0]:
    print('YES')
    print(n * s[1] + n * t[0] + n * s[0])
elif n == 1:
    options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
    for i in options:
        if s not in i and t not in i:
            print('YES')
            print(i)
            break

elif n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(solution)


from itertools import permutations
import random

n = int(input().strip())
s = input().strip()
t = input().strip()

#print(n, s, t)

def doEven(n, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j and n % 2 == 0:
            return i
        flag[0] = 1

def doOdd(x, s, t):
    d = ['a', 'a', 'b', 'b', 'c', 'c']
    #print(d)
    filePerms = []
    for i in permutations(d):
        if i not in filePerms:
            filePerms.append(i)
    #print(filePerms)
    #print(len(filePerms))

    for i in range(len(filePerms)):
        filePerms[i] = ''.join(filePerms[i])
    #print(filePerms)
    cases = []
    #print(s, t)
    for i in filePerms:
        if s not in i and t not in i:
            cases.append(i)
    #print(cases)
    for i in cases:
        j = i + i
        if s not in j and t not in j:
            options = ['abc', 'acb', 'bac', 'bca', 'cab', 'cba']
            for k in options:
                possible = k + i
                if s not in possible and t not in possible:
                    #print()
                    #print(k)
                    #print(i)
                    return k + int(x / 2) * i
            for k in options:
                possible = i + k
                if s not in possible and t not in possible:
                    #print()
                    #print(i)
                    #print(k)
                    return int(x / 2) * i + k
        flag[0] = 1

def do(begin, x, y):
    choose = random.randrange(0, 3)
    new = begin[choose]
    begin = begin[:choose] + begin[choose + 1:]
    while len(new) < len(start):
        position = random.randrange(0, len(begin))
        #print(position, begin[position])
        new = new + begin[position:position + 1]
        begin = begin[:position] + begin[position + 1:]
        #print(new, begin)
        if x in new or y in new:
            return ''
        elif len(new) == len(start):
            flag[0] = 1
            return new
        #time.sleep(0.1)

flag = [0]
if n == 1:
    while flag[0] == 0:
        start = 'abc'
        result = do(start, s, t)
    print('YES')
    print(result)

elif n % 2 == 0:
    solution = doEven(n, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(int(n / 2) * solution)
else:
    solution = doOdd(n - 1, s, t)
    #print()
    #print(n, s, t)
    if flag[0] == 1:
        print('NO')
    else:
        print('YES')
        print(solution)


// kotlin tips b/c I'm bad

/** useful links
 * https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html
 * https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-array-list/index.html
 * https://kotlinlang.org/docs/reference/ranges.html
 */

/** valid ways to sort
 * 1
 * val a = nextLongs().sorted() // a is mutable list
 * 2
 * val a = arrayListOf<Long>()
 * a.addAll(nextLongs())
 * a.sort()
 */

/** declare 2D array
    * val ori = Array(n, {IntArray(n)})
    * val ori = arrayOf(
        intArrayOf(8, 9, 1, 13),
        intArrayOf(3, 12, 7, 5),
        intArrayOf(0, 2, 4, 11),
        intArrayOf(6, 10, 15, 14)
      )
 */

/** printing variables:
 * println("$l and $r")
 * evidently print has high constant factor
 * print stringbuilder instead?
 */

// ArrayList to Array: toArray

// IntArray with size:
// val arr = IntArray(1 shl 20, { 1 })

// lower bound: use binary search
// https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/binary-search.html

// if/switch
// https://kotlinlang.org/docs/reference/control-flow.html

import java.util.*

val MX = 1000005
val MOD = 998244353
val SZ = 1 shl 19
val INF = (1e18).toLong()

fun add(a: Int, b: Int) = (a + b) % MOD
fun sub(a: Int, b: Int) = (a - b + MOD) % MOD
fun mul(a: Int, b: Int) = ((a.toLong() * b) % MOD).toInt()

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextInts() = next().split(" ").map { it.toInt() }
fun nextLongs() = next().split(" ").map { it.toLong() }

var n = 0

fun check(x: String, s: String, t: String) {
    for (i in 0..x.length-2) {
        if (x.substring(i,i+2) == s) return
        if (x.substring(i,i+2) == t) return
    }
    println("YES")
    print(x)
    System.exit(0)
}

fun gen(x: String) : String {
    val v = StringBuilder()
    for (i in 1..n) v.append(x)
    return v.toString()
}

fun GEN(x: String, y: String, z: String) : String {
    val v = StringBuilder()
    for (i in 1..n) v.append(x)
    for (i in 1..n) v.append(y)
    for (i in 1..n) v.append(z)
    return v.toString()
}

fun solve() {
    n = nextInt()
    val s = next()
    val t = next()
    check(gen("abc"),s,t)
    check(gen("cba"),s,t)
    check(GEN("a","b","c"),s,t)
    check(GEN("a","c","b"),s,t)
    check(GEN("b","c","a"),s,t)
    check(GEN("b","a","c"),s,t)
    check(GEN("c","a","b"),s,t)
    check(GEN("c","b","a"),s,t)
}

fun main(args: Array<String>) {
    val T = 1
    for (i in 1..T) solve()
}


fun main() {
    val n = readLine()!!.toInt()

    val t = readLine()!!
    val s = readLine()!!

    var validStart = mutableListOf("abc", "acb", "bac", "bca", "cab", "cba")

    var found = false
    for(start in validStart) {
        if(!contains(start, t, s)) {
            println("YES")
            var full = ""
            for(i in 1..n) full += start
            println(full)
            found = true
            break
        }
    }

    if(!found) {
        var sol = ""
        for(a in 'a' .. 'c') {
            if(found) break;
            for (b in 'a' .. 'c') {
                if(found) break;
                for (c in 'a' .. 'c') {
                    if (a != b && b != c && a != c) {
                        var corner = a + "" + b + "" + c
                        if (!contains(corner, t, s)) {
                            found = true
                            sol = corner
                            break
                        }
                    }
                }
            }
        }
        if(found) {
            println("YES")
            println(sol)
        } else println("NO")
    }

}

fun contains(prefix: String, t: String, s: String) : Boolean {
    var res = false

    var fullPrefix = prefix + prefix

    for(i in 1 until fullPrefix.length) {
        if(fullPrefix[i-1] == t[0] && fullPrefix[i] == t[1]) {
            res = true
            break
        }
        if(fullPrefix[i-1] == s[0] && fullPrefix[i] == s[1]) {
            res = true
            break
        }
    }

    return res
}


fun main() {
    val n = readLine()!!.toInt()

    val t = readLine()!!
    val s = readLine()!!

    var validStart = mutableListOf("abc", "acb", "bac", "bca", "cab", "cba")

    var found = false
    for(start in validStart) {
        var full = start.repeat(n)

        if(!full.contains(t) && !full.contains(s)) {
            println("YES")
            println(full)
            found = true
            break
        }
    }

    if(!found) {
        var sol = ""
        for(a in 'a'..'c')
            for(b in 'a'..'c')
                for(c in 'a'..'c')
                    if(a != b && b != c && a != c) {
                        var corner = a + "" + b + "" + c

                        if(!corner.contains(t) && !corner.contains(s)) {
                            found = true
                            sol = (a.toString()).repeat(n) + (b.toString()).repeat(n) + (c.toString()).repeat(n)
                        }
                    }
        if(found) {
            println("YES")
            println(sol)
        } else println("NO")
    }

}


fun main() {
    val n = readLine()!!.toInt()

    val t = readLine()!!
    val s = readLine()!!

    var validStart = mutableListOf("abc", "acb", "bac", "bca", "cab", "cba")

    var found = false
    for(start in validStart) {
        var full = ""
        start.repeat(n)

        if(!full.contains(t) && !full.contains(s)) {
            println("YES")
            println(full)
            found = true
            break
        }
    }

    if(!found) {
        var sol = ""
        for(a in 'a'.toInt() .. 'c'.toInt())
            for(b in 'a'.toInt() .. 'c'.toInt())
                for(c in 'a'.toInt() .. 'c'.toInt())
                    if(a != b && b != c && a != c) {
                        var corner = a.toChar() + "" + b.toChar() + c.toChar()

                        if(!corner.contains(t) && !corner.contains(s)) {
                            found = true
                            sol = (a.toChar()+"").repeat(n) + (b.toChar()+"").repeat(n) + (c.toChar()+"").repeat(n)
                        }
                    }
        if(found) {
            println("YES")
            println(sol)
        } else println("NO")
    }

}


fun main() {
    val n = readLine()!!.toInt()

    val t = readLine()!!
    val s = readLine()!!

    var validStart = mutableListOf("abc", "acb", "bac", "bca", "cab", "cba")

    var found = false
    for(start in validStart) {
        if(!contains(start, t, s)) {
            println("YES")
            var full = ""
            for(i in 1..n) full += start
            println(full)
            found = true
            break
        }
    }

    if(!found) {
        var sol = ""
        for(a in 'a' .. 'c') {
            if(found) break;
            for (b in 'a' .. 'c') {
                if(found) break;
                for (c in 'a' .. 'c') {
                    if (a != b && b != c && a != c) {
                        var corner = a + "" + b + "" + c
                        if (!corner.contains(t) && !corner.contains(s)) {
                            found = true
                            sol = corner
                            break
                        }
                    }
                }
            }
        }
        if(found) {
            println("YES")
            println(sol)
        } else println("NO")
    }

}

fun contains(prefix: String, t: String, s: String) : Boolean {
    var res = false

    var fullPrefix = prefix + prefix

    for(i in 1 until fullPrefix.length) {
        if(fullPrefix[i-1] == t[0] && fullPrefix[i] == t[1]) {
            res = true
            break
        }
        if(fullPrefix[i-1] == s[0] && fullPrefix[i] == s[1]) {
            res = true
            break
        }
    }

    return res
}


fun main() {
    val n = readLine()!!.toInt()

    val t = readLine()!!
    val s = readLine()!!

    var validStart = mutableListOf("abc", "acb", "bac", "bca", "cab", "cba")

    var found = false
    for(start in validStart) {
        var full = ""
        for(i in 1..n) full += start

        if(!full.contains(t) && !full.contains(s)) {
            println("YES")
            println(full)
            found = true
            break
        }
    }

    if(!found) {
        var sol = ""
        for(a in 'a'.toInt() .. 'c'.toInt())
            for(b in 'a'.toInt() .. 'c'.toInt())
                for(c in 'a'.toInt() .. 'c'.toInt())
                    if(a != b && b != c && a != c) {
                        var corner = ""
                        for(i in 1..n) corner += a.toChar()
                        for(i in 1..n) corner += b.toChar()
                        for(i in 1..n) corner += c.toChar()

                        if(!corner.contains(t) && !corner.contains(s)) {
                            found = true
                            sol = corner
                        }
                    }
        if(found) {
            println("YES")
            println(sol)
        } else println("NO")
    }

}


fun main() {
    val n = readLine()!!.toInt()

    val t = readLine()!!
    val s = readLine()!!

    var validStart = mutableListOf("abc", "acb", "bac", "bca", "cab", "cba")

    var found = false
    for(start in validStart) {
        var full = start.repeat(n)

        if(!full.contains(t) && !full.contains(s)) {
            println("YES")
            println(full)
            found = true
            break
        }
    }

    if(!found) {
        var sol = ""
        for(a in 'a'.toInt() .. 'c'.toInt())
            for(b in 'a'.toInt() .. 'c'.toInt())
                for(c in 'a'.toInt() .. 'c'.toInt())
                    if(a != b && b != c && a != c) {
                        var corner = a.toChar() + "" + b.toChar() + c.toChar()

                        if(!corner.contains(t) && !corner.contains(s)) {
                            found = true
                            sol = (a.toChar()+"").repeat(n) + (b.toChar()+"").repeat(n) + (c.toChar()+"").repeat(n)
                        }
                    }
        if(found) {
            println("YES")
            println(sol)
        } else println("NO")
    }

}


import kotlin.math.min

fun main() {
    val n = readLine()!!.toInt()

    val t = readLine()!!
    val s = readLine()!!

    var validStart = mutableListOf("abc", "acb", "bac", "bca", "cab", "cba")

    var found = false
    for(start in validStart) {
        var full = ""
        for(i in 1..min(2, n)) full += start
        if(!contains(full, t, s)) {
            println("YES")
            full = start.repeat(n)
            println(full)
            found = true
            break
        }
    }

    if(!found) {
        var sol = ""
        for(a in 'a' .. 'c') {
            if(found) break;
            for (b in 'a' .. 'c') {
                if(found) break;
                for (c in 'a' .. 'c') {
                    if (a != b && b != c && a != c) {
                        var corner = a + "" + b + "" + c
                        if (!contains(corner, t, s)) {
                            found = true
                            sol = corner.repeat(n)
                            break
                        }
                    }
                }
            }
        }
        if(found) {
            println("YES")
            println(sol)
        } else println("NO")
    }

}

fun contains(prefix: String, t: String, s: String) : Boolean {
    var res = false

    for(i in 1 until prefix.length) {
        if(prefix[i-1] == t[0] && prefix[i] == t[1]) {
            res = true
            break
        }
        if(prefix[i-1] == s[0] && prefix[i] == s[1]) {
            res = true
            break
        }
    }

    return res
}


import kotlin.math.min

// なんか本番でエラーでる
private val isDebug = runCatching {
  System.getenv("MY_DEBUG") != null
}.fold({it}, {false})

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }.toIntArray()
private fun readLongs() = readStrings().map { it.toLong() }.toLongArray()
private fun debug(msg: () -> String) {
  if (isDebug) System.err.println(msg())
}
private fun debug(a: IntArray) {
  if (isDebug) debug{a.joinToString(" ")}
}
private fun debugDim(A: Array<IntArray>) {
  if (isDebug) {
    for (a in A) {
      debug(a)
    }
  }
}

val MOD = 1000000007

fun main() {
  val N = readInt()
  val S = readLine()!!
  val T = readLine()!!
  val (s1, s2) = S.toCharArray()
  val (t1, t2) = T.toCharArray()
  val type = BooleanArray(3){true}
  fun typeOf(c1: Char, c2: Char): Int {
    val a1 = c1-'a'
    val a2 = c2-'a'
    return if (a1 == a2) 0
      else if (a2 == (a1 + 1)%3) 1
      else 2
  }

  type[typeOf(s1, s2)] = false
  type[typeOf(t1, t2)] = false
  val tp = type.indexOf(true)
  val str = StringBuilder()
  when(tp) {
    0 -> {
      top@for (i in 0 until 3) {
        for (j in 0 until 3) {
          for (k in 0 until 3) {
            val loop = "${'a'+i}${'a'+j}${'a'+k}"
            if (i != j && j != k && i != k && !loop.contains(S) && !loop.contains(T)) {
              repeat(N) {str.append('a'+i)}
              repeat(N) {str.append('a'+j)}
              repeat(N) {str.append('a'+k)}
              break@top
            }
          }
        }
      }
    }
    1 -> {
      repeat(N) {
        for (i in 0 until 3) {
          val c = 'a' + i
          str.append(c)
        }
      }
    }
    else -> {
      repeat(N) {
        for (i in 2 downTo 0) {
          val c = 'a' + i
          str.append(c)
        }
      }
    }
  }
  println("YES")
  println(str.toString())
}


import kotlin.math.min

// なんか本番でエラーでる
private val isDebug = runCatching {
  System.getenv("MY_DEBUG") != null
}.fold({it}, {false})

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }.toIntArray()
private fun readLongs() = readStrings().map { it.toLong() }.toLongArray()
private fun debug(msg: () -> String) {
  if (isDebug) System.err.println(msg())
}
private fun debug(a: IntArray) {
  if (isDebug) debug{a.joinToString(" ")}
}
private fun debugDim(A: Array<IntArray>) {
  if (isDebug) {
    for (a in A) {
      debug(a)
    }
  }
}

val MOD = 1000000007

fun main() {
  val N = readInt()
  val S = readLine()!!
  val T = readLine()!!
  val (s1, s2) = S.toCharArray()
  val (t1, t2) = T.toCharArray()
  val type = BooleanArray(3){true}
  fun typeOf(c1: Char, c2: Char): Int {
    val a1 = c1-'a'
    val a2 = c2-'a'
    return if (a1 == a2) 0
      else if (a2 == (a1 + 1)%3) 1
      else 2
  }

  type[typeOf(s1, s2)] = false
  type[typeOf(t1, t2)] = false
  val tp = type.indexOf(true)
  val str = StringBuilder()
  when(tp) {
    0 -> {
      top@for (i in 0 until 3) {
        for (j in 0 until 3) {
          for (k in 0 until 3) {
            val loop = "${'a'+i}${'a'+j}${'a'+k}${'a'+i}"
            if (i != j && j != k && i != k && !loop.contains(S) && !loop.contains(T)) {
              repeat(N) {str.append('a'+i)}
              repeat(N) {str.append('a'+j)}
              repeat(N) {str.append('a'+k)}
              break@top
            }
          }
        }
      }
    }
    1 -> {
      repeat(N) {
        for (i in 0 until 3) {
          val c = 'a' + i
          str.append(c)
        }
      }
    }
    else -> {
      repeat(N) {
        for (i in 2 downTo 0) {
          val c = 'a' + i
          str.append(c)
        }
      }
    }
  }
  println("YES")
  println(str.toString())
}


import java.io.PrintWriter
import java.util.StringTokenizer

fun main() {
    val n = readInt()
    val st = readStrings(2)

    val (eqs, neqs) = st.partition { it[0] == it[1] }

    val p4 = listOf(
        "abca",
        "acba",
        "bacb",
        "bcab",
        "cabc",
        "cbac"
    )

    val ans = when (eqs.size) {
        2 -> "abc".repeat(n)
        1 -> {
            p4.first { neqs.first() !in it }.substring(0, 3).repeat(n)
        }
        else -> {
            val p = p4.map { it.substring(0, 3) }.first { p -> neqs.none { it in p } }
            p.asIterable().joinToString("") { it.toString().repeat(n) }
        }
    }

    output {
        println("YES")
        println(ans)
    }
}

fun readLn() = readLine()!!
private var tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLine() ?: return "", " ")
    return tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }

inline fun output(block: PrintWriter.()->Unit) { PrintWriter(System.out, false).apply(block).flush() }


import java.io.PrintWriter
import java.util.StringTokenizer

fun main() {
    val n = readInt()
    val st = readStrings(2)

    val neqs = st.filter { it[0] != it[1] }

    val p4 = listOf(
        "abca",
        "acba",
        "bacb",
        "bcab",
        "cabc",
        "cbac"
    )

    val ans = when (neqs.size) {
        0 -> "abc".repeat(n)
        1 -> {
            p4.first { neqs.first() !in it }.substring(0, 3).repeat(n)
        }
        else -> {
            val p = p4.map { it.substring(0, 3) }.first { p -> neqs.none { it in p } }
            p.asIterable().joinToString("") { it.toString().repeat(n) }
        }
    }

    output {
        println("YES")
        println(ans)
    }
}

fun readLn() = readLine()!!
private var tokenizer: StringTokenizer = StringTokenizer("")
fun read(): String {
    while (tokenizer.hasMoreTokens().not()) tokenizer = StringTokenizer(readLine() ?: return "", " ")
    return tokenizer.nextToken()
}
fun readInt() = read().toInt()
fun readDouble() = read().toDouble()
fun readLong() = read().toLong()
fun readStrings(n: Int) = List(n) { read() }
fun readInts(n: Int) = List(n) { read().toInt() }
fun readDoubles(n: Int) = List(n) { read().toDouble() }
fun readLongs(n: Int) = List(n) { read().toLong() }

inline fun output(block: PrintWriter.()->Unit) { PrintWriter(System.out, false).apply(block).flush() }


//Kotlin 1.1

fun main(args: Array<String>) {

    val n = readLine()?.toLong()
    val pair1 = readLine()?.toString()
    val pair2 = readLine()?.toString()

    var flag: Boolean = false
    var res: String = ""

    if (!"aabbcc".contains(pair1!!) && !"aabbcc".contains(pair2!!)) {
        val s1 = generate_type_1('a', 'b', 'c', n!!)
        if (!s1.contains(pair1!!) && !s1.contains(pair2!!)) {
            flag = true
            res = s1
        }
    }

    if (!flag && !"aaccbb".contains(pair1!!) && !"aaccbb".contains(pair2!!)) {
        val s2 = generate_type_1('a', 'c', 'b', n!!)
        if (!s2.contains(pair1!!) && !s2.contains(pair2!!)) {
            flag = true
            res = s2
        }
    }

    if (!flag && !"bbaacc".contains(pair1!!) && !"bbaacc".contains(pair2!!)) {
        val s3 = generate_type_1('b', 'a', 'c', n!!)
        if (!s3.contains(pair1!!) && !s3.contains(pair2!!)) {
            flag = true
            res = s3
        }
    }

    if (!flag && !"bbccaa".contains(pair1!!) && !"bbccaa".contains(pair2!!)) {
        val s4 = generate_type_1('b', 'c', 'a', n!!)
        if (!s4.contains(pair1!!) && !s4.contains(pair2!!)) {
            flag = true
            res = s4
        }
    }

    if (!flag && !"ccaabb".contains(pair1!!) && !"ccaabb".contains(pair2!!)) {
        val s5 = generate_type_1('c', 'a', 'b', n!!)
        if (!s5.contains(pair1!!) && !s5.contains(pair2!!)) {
            flag = true
            res = s5
        }
    }

    if (!flag && !"ccbbaa".contains(pair1!!) && !"ccbbaa".contains(pair2!!)) {
        val s6 = generate_type_1('c', 'b', 'a', n!!)
        if (!s6.contains(pair1!!) && !s6.contains(pair2!!)) {
            flag = true
            res = s6
        }
    }

    if (!flag && !"abcabc".contains(pair1!!) && !"abcabc".contains(pair2!!)) {
        val s7 = generate_type_2('a', 'b', 'c', n!!)
        if (!s7.contains(pair1!!) && !s7.contains(pair2!!)) {
            flag = true
            res = s7
        }
    }

    if (!flag && !"acbacb".contains(pair1!!) && !"acbacb".contains(pair2!!)) {
        val s8 = generate_type_2('a', 'c', 'b', n!!)
        if (!s8.contains(pair1!!) && !s8.contains(pair2!!)) {
            flag = true
            res = s8
        }
    }

    if (!flag && !"bacbac".contains(pair1!!) && !"bacbac".contains(pair2!!)) {
        val s9 = generate_type_2('b', 'a', 'c', n!!)
        if (!s9.contains(pair1!!) && !s9.contains(pair2!!)) {
            flag = true
            res = s9
        }
    }

    if (!flag && !"bcabca".contains(pair1!!) && !"bcabca".contains(pair2!!)) {
        val s10 = generate_type_2('b', 'c', 'a', n!!)
        if (!s10.contains(pair1!!) && !s10.contains(pair2!!)) {
            flag = true
            res = s10
        }
    }

    if (!flag && !"cbacba".contains(pair1!!) && !"cbacba".contains(pair2!!)) {
        val s11 = generate_type_2('c', 'b', 'a', n!!)
        if (!s11.contains(pair1!!) && !s11.contains(pair2!!)) {
            flag = true
            res = s11
        }
    }

    if (!flag && !"cabcab".contains(pair1!!) && !"cabcab".contains(pair2!!)) {
        val s12 = generate_type_2('c', 'a', 'b', n!!)
        if (!s12.contains(pair1!!) && !s12.contains(pair2!!)) {
            flag = true
            res = s12
        }
    }

    println("YES")
    println(res)
}

// generate string like a^n b^n c^n -> 6 possibilites
fun generate_type_1(c1: Char, c2: Char, c3: Char, dups: Long): String {
    var s = ""
    for (i in 0..dups - 1) {
        s += c1.toString()
    }
    for (i in 0..dups - 1) {
        s += c2.toString()
    }
    for (i in 0..dups - 1) {
        s += c3.toString()
    }
    return s
}

// generate string like (abc)^n -> 6 possibilities
fun generate_type_2(c1: Char, c2: Char, c3: Char, dups: Long): String {
    var s = ""
    for (i in 0..dups - 1) {
        s += c1.toString() + c2.toString() + c3.toString()
    }
    return s
}


//Kotlin 1.1

fun main(args: Array<String>) {

    val n = readLine()?.toLong()
    val pair1 = readLine()?.toString()
    val pair2 = readLine()?.toString()

    var flag: Boolean = false
    var res: String = ""
    val s1 = generate_type_1('a', 'b', 'c', n!!)
    if (!s1.contains(pair1!!) && !s1.contains(pair2!!)) {
        flag = true
        res = s1
    }

    if (!flag) {
        val s2 = generate_type_1('a', 'c', 'b', n!!)
        if (!s2.contains(pair1!!) && !s2.contains(pair2!!)) {
            flag = true
            res = s2
        }
    }

    if (!flag) {
        val s3 = generate_type_1('b', 'a', 'c', n!!)
        if (!s3.contains(pair1!!) && !s3.contains(pair2!!)) {
            flag = true
            res = s3
        }
    }

    if (!flag) {
        val s4 = generate_type_1('b', 'c', 'a', n!!)
        if (!s4.contains(pair1!!) && !s4.contains(pair2!!)) {
            flag = true
            res = s4
        }
    }

    if (!flag) {
        val s5 = generate_type_1('c', 'a', 'b', n!!)
        if (!s5.contains(pair1!!) && !s5.contains(pair2!!)) {
            flag = true
            res = s5
        }
    }

    if (!flag) {
        val s6 = generate_type_1('c', 'b', 'a', n!!)
        if (!s6.contains(pair1!!) && !s6.contains(pair2!!)) {
            flag = true
            res = s6
        }
    }

    if (!flag) {
        val s7 = generate_type_2('a', 'b', 'c', n!!)
        if (!s7.contains(pair1!!) && !s7.contains(pair2!!)) {
            flag = true
            res = s7
        }
    }

    if (!flag) {
        val s8 = generate_type_2('a', 'c', 'b', n!!)
        if (!s8.contains(pair1!!) && !s8.contains(pair2!!)) {
            flag = true
            res = s8
        }
    }

    if (!flag) {
        val s9 = generate_type_2('b', 'a', 'c', n!!)
        if (!s9.contains(pair1!!) && !s9.contains(pair2!!)) {
            flag = true
            res = s9
        }
    }

    if (!flag) {
        val s10 = generate_type_2('b', 'c', 'a', n!!)
        if (!s10.contains(pair1!!) && !s10.contains(pair2!!)) {
            flag = true
            res = s10
        }
    }

    if (!flag) {
        val s11 = generate_type_2('c', 'b', 'a', n!!)
        if (!s11.contains(pair1!!) && !s11.contains(pair2!!)) {
            flag = true
            res = s11
        }
    }

    if (!flag) {
        val s12 = generate_type_2('c', 'a', 'b', n!!)
        if (!s12.contains(pair1!!) && !s12.contains(pair2!!)) {
            flag = true
            res = s12
        }
    }

    println("YES")
    println(res)
}

// generate string like a^n b^n c^n -> 6 possibilites
fun generate_type_1(c1: Char, c2: Char, c3: Char, dups: Long): String {
    var s = ""
    for (i in 0..dups - 1) {
        s += c1.toString()
    }
    for (i in 0..dups - 1) {
        s += c2.toString()
    }
    for (i in 0..dups - 1) {
        s += c3.toString()
    }
    return s
}

// generate string like (abc)^n -> 6 possibilities
fun generate_type_2(c1: Char, c2: Char, c3: Char, dups: Long): String {
    var s = ""
    for (i in 0..dups - 1) {
        s += c1.toString() + c2.toString() + c3.toString()
    }
    return s
}


//Kotlin 1.1

fun main(args: Array<String>) {

    val n = readLine()?.toLong()
    val pair1 = readLine()?.toString()
    val pair2 = readLine()?.toString()

    var flag: Boolean = false
    var res: String = ""
    var c1: Char = 'a'
    var c2: Char = 'b'
    var c3: Char = 'c'

    if (!"aabbcc".contains(pair1!!) && !"aabbcc".contains(pair2!!)) {
        c1 = 'a'
        c2 = 'b'
        c3 = 'c'
        flag = true
        println("YES")
        generate_type_1(c1, c2, c3, n!!)
    }

    if (!flag && !"aaccbb".contains(pair1!!) && !"aaccbb".contains(pair2!!)) {
        c1 = 'a'
        c2 = 'c'
        c3 = 'b'
        flag = true
        println("YES")
        generate_type_1(c1, c2, c3, n!!)
    }

    if (!flag && !"bbaacc".contains(pair1!!) && !"bbaacc".contains(pair2!!)) {
        c1 = 'b'
        c2 = 'a'
        c3 = 'c'
        flag = true
        println("YES")
        generate_type_1(c1, c2, c3, n!!)
    }

    if (!flag && !"bbccaa".contains(pair1!!) && !"bbccaa".contains(pair2!!)) {
        c1 = 'b'
        c2 = 'c'
        c3 = 'a'
        flag = true
        println("YES")
        generate_type_1(c1, c2, c3, n!!)
    }

    if (!flag && !"ccaabb".contains(pair1!!) && !"ccaabb".contains(pair2!!)) {
        c1 = 'c'
        c2 = 'a'
        c3 = 'b'
        flag = true
        println("YES")
        generate_type_1(c1, c2, c3, n!!)
    }

    if (!flag && !"ccbbaa".contains(pair1!!) && !"ccbbaa".contains(pair2!!)) {
        c1 = 'c'
        c2 = 'b'
        c3 = 'a'
        flag = true
        println("YES")
        generate_type_1(c1, c2, c3, n!!)
    }

    if (!flag && !"abcabc".contains(pair1!!) && !"abcabc".contains(pair2!!)) {
        c1 = 'a'
        c2 = 'b'
        c3 = 'c'
        flag = true
        println("YES")
        generate_type_2(c1, c2, c3, n!!)
    }

    if (!flag && !"acbacb".contains(pair1!!) && !"acbacb".contains(pair2!!)) {
        c1 = 'a'
        c2 = 'c'
        c3 = 'b'
        flag = true
        println("YES")
        generate_type_2(c1, c2, c3, n!!)
    }

    if (!flag && !"bacbac".contains(pair1!!) && !"bacbac".contains(pair2!!)) {
        c1 = 'b'
        c2 = 'a'
        c3 = 'c'
        flag = true
        println("YES")
        generate_type_2(c1, c2, c3, n!!)
    }

    if (!flag && !"bcabca".contains(pair1!!) && !"bcabca".contains(pair2!!)) {
        c1 = 'b'
        c2 = 'c'
        c3 = 'a'
        flag = true
        println("YES")
        generate_type_2(c1, c2, c3, n!!)
    }

    if (!flag && !"cbacba".contains(pair1!!) && !"cbacba".contains(pair2!!)) {
        c1 = 'c'
        c2 = 'b'
        c3 = 'a'
        flag = true
        println("YES")
        generate_type_2(c1, c2, c3, n!!)
    }

    if (!flag && !"cabcab".contains(pair1!!) && !"cabcab".contains(pair2!!)) {
        c1 = 'c'
        c2 = 'a'
        c3 = 'b'
        flag = true
        println("YES")
        generate_type_2(c1, c2, c3, n!!)
    }
}

fun print_string(c1: Char, c2: Char, c3: Char, dups: Long) {

}

// generate string like a^n b^n c^n -> 6 possibilites
fun generate_type_1(c1: Char, c2: Char, c3: Char, dups: Long) {
    //var s = ""
    for (i in 0..dups - 1) {
        //s += c1.toString()
        print(c1.toString())
    }
    for (i in 0..dups - 1) {
        //s += c2.toString()
        print(c2.toString())
    }
    for (i in 0..dups - 1) {
        //s += c3.toString()
        print(c3.toString())
    }
    //return s
}

// generate string like (abc)^n -> 6 possibilities
fun generate_type_2(c1: Char, c2: Char, c3: Char, dups: Long) {
    //var s = ""
    for (i in 0..dups - 1) {
        //s += c1.toString() + c2.toString() + c3.toString()
        print(c1.toString())
        print(c2.toString())
        print(c3.toString())
    }
    //return s
}


import java.util.*

val sc = Scanner(System.`in`)

fun main() {
    println("YES")
    val outLength = sc.nextInt()
    val forbidden1 = sc.next()
    val (f1, t1) = forbidden1.toCharArray()
    val self1 = f1 == t1

    val forbidden2 = sc.next()
    val (f2, t2) = forbidden2.toCharArray()
    val self2 = f2 == t2

    if (self1 && self2) {
        println("abc".repeat(outLength))
        return
    }

    if (self1 || self2) {
        if (!"abca".contains(forbidden1) && !"abca".contains(forbidden2)) {
            println("abc".repeat(outLength))
            return
        } else {
            println("cba".repeat(outLength))
            return
        }
    }

    if (f1 == t2 && t1 == f2) {
        println(t1.toString().repeat(outLength) + other(t1, f1).toString().repeat(outLength) + f1.toString().repeat(outLength))
        return
    }

    var out = t1.toString().repeat(outLength) + f1.toString().repeat(outLength)

    if(f1 != f2){
        out += other(t1,f1).toString().repeat(outLength)
    }else{
        out = other(t1,f1).toString().repeat(outLength) + out
    }

    println(out)

//    repeat(sc.nextInt(), ::solve)
}

fun other(t1: Char, f1: Char): Char {
    return mutableSetOf('a', 'b', 'c').apply { removeAll(listOf(t1, f1)) }.first()
}

fun solve(i: Int) {
    val paginas = sc.nextLong()
    val m = sc.nextLong()

    val cycle = mutableListOf(m % 10)
    do {
        cycle.add((cycle.last() + m) % 10)
    } while (cycle.last() != 0L)

    val cycleSum = cycle.sum()

    val nbCycles = paginas / (m * cycle.size)
    var partialSum = nbCycles * cycleSum

    partialSum += cycle.take(((paginas - (nbCycles * m * cycle.size)) / m).toInt()).sum()

    println(partialSum)
}


import java.util.*

val sc = Scanner(System.`in`)

fun main() {
    println("YES")
    val outLength = sc.nextInt()
    val forbidden1 = sc.next()
    val (f1, t1) = forbidden1.toCharArray()
    val self1 = f1 == t1

    val forbidden2 = sc.next()
    val (f2, t2) = forbidden2.toCharArray()
    val self2 = f2 == t2

    if (self1 && self2) {
        println("abc".repeat(outLength))
        return
    }

    if (self1 || self2) {
        if (!"abca".contains(forbidden1) && !"abca".contains(forbidden2)) {
            println("abc".repeat(outLength))
            return
        } else {
            println("cba".repeat(outLength))
            return
        }
    }

    if (f1 == t2 && t1 == f2) {
        t1.toString().repeat(outLength) + other(t1, f1).toString().repeat(outLength) + f1.toString().repeat(outLength)
    }

    var out = t1.toString().repeat(outLength) + f1.toString().repeat(outLength)

    if(f1 != f2){
        out += other(t1,f1).toString().repeat(outLength)
    }else{
        out = other(t1,f1).toString().repeat(outLength) + out
    }

    println(out)

//    repeat(sc.nextInt(), ::solve)
}

fun other(t1: Char, f1: Char): Char {
    return mutableSetOf('a', 'b', 'c').apply { removeAll(listOf(t1, f1)) }.first()
}

fun solve(i: Int) {
    val paginas = sc.nextLong()
    val m = sc.nextLong()

    val cycle = mutableListOf(m % 10)
    do {
        cycle.add((cycle.last() + m) % 10)
    } while (cycle.last() != 0L)

    val cycleSum = cycle.sum()

    val nbCycles = paginas / (m * cycle.size)
    var partialSum = nbCycles * cycleSum

    partialSum += cycle.take(((paginas - (nbCycles * m * cycle.size)) / m).toInt()).sum()

    println(partialSum)
}


import java.util.*
import kotlin.math.*
private fun readLn() = readLine()!! // string
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() //long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map {it.toLong()} // list of longs

fun main() {
    val n = readInt()
    val s = readLn()
    val t = readLn()
    val sol = ArrayList<Char>()
    val arr = arrayOf('a','b','c')
        val ans = Array(3,{i->'a'})
        for(i in 0..2) for(j in 0..2) for(k in 0..2)
        {
            if(i==j || j == k || i == k) continue
            var st = arr[i].toString()+arr[j].toString()+arr[k].toString()+arr[i].toString()
            var good = true
            for(u in 0..2)
            {
                val ss = st.substring(u,u+2)
                if(ss == s || ss == t)
                {
                    good = false
                }
            }
            if(good) for(u in 0..2) ans[u] = st[u]
        }
        for(j in 1..n) for(i in 0..2) sol.add(ans[i])
    println("YES")
    println(sol.joinToString(""))

}


import java.util.*
import kotlin.math.*
private fun readLn() = readLine()!! // string
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() //long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map { it.toInt() } // list of ints
private fun readLongs() = readStrings().map {it.toLong()} // list of longs

fun main() {
    val n = readInt()
    val s = readLn()
    val t = readLn()
    val sol = ArrayList<Char>()
    val arr = arrayOf('a','b','c')
        val ans = Array(3,{i->'a'})
        for(i in 0..2) for(j in 0..2) for(k in 0..2)
        {
            if(i==j || j == k || i == k) continue
            var st = arr[i].toString()+arr[j].toString()+arr[k].toString()+arr[i].toString()
            var good = true
            for(u in 0..2)
            {
                val ss = st.substring(u,u+2)
                if(ss == s || ss == t)
                {
                    good = false
                }
            }
            if(good) for(u in 0..2) ans[u] = st[u]
        }

    println("YES")
    if(s[0] == t[1] && s[1] == t[0])
    {
        ans[0] = s[0]; ans[2] = s[1];
        while(ans[1] == s[0] || ans[1] == s[1]) ans[1]++
        for(i in 0..2) for(j in 1..n) sol.add(ans[i])
    } else for(j in 1..n) for(i in 0..2) sol.add(ans[i])
    println(sol.joinToString(""))

}