Harryxun/stf_run huggingface dataset:
def margin0(n):
    if n < 10:
        return f"00".format(n)
    elif n < 100:
        return "0{}".fomrat(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name)

### FIXED CODE ###

# -*- coding: utf-8 -*-
def margin0(n):
    if n < 10:
        return "00{}".format(n)
    elif n < 100:
        return "0{}".format(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name[:3])
N = int(input())
A = [int(n) for n in input().split()]

def main():
    a = sorted(A)
    odd = N % 2 != 0
    if odd:
        a = list(map(lambda t: t[1] if t[0] % 2 == 0 else t[1] - 1, enumerate(a)))
    else:
        a = list(map(lambda t: t[1] - 1 if t[0] % 2 == 0 else t[1], enumerate(a)))
    passed = a == list(range(N))
    if passed:
        base = N - 1 if odd else N
        ans = int(2 ** (base / 2))
    else:
        ans = 0
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

N = int(input())
A = [int(n) for n in input().split()]

def main():
    d = {}
    for a in A:
        if a not in d:
            d[a] = 0
        d[a] += 1
    ks =  all(map(lambda k: k % 2 == 0, d.keys())) or all(map(lambda k: k % 2 != 0, d.keys()))
    if 0 in d:
        d[0] += 1
    vs = all(map(lambda v: v == 2, d.values()))

    if ks and vs:
        n = N if N % 2 == 0 else N - 1
        n //= 2
        ans = 1
        for _ in range(n):
            ans *= 2
            ans %= 1000000007
    else:
        ans = 0
    print(ans)

if __name__ == '__main__':
    main()
numbers = list(map(int, input().split()))

for i in range(len(numbers)-1):
    for j in range(len(numbers)-1-i):
        if(numbers[j] > numbers[j+i]):
            temp = numbers[j]
            numbers[j] = numbers[j+1]
            numbers[j+1] = temp
            
print(f'numbers[0] numbers[1] numbers[2])


### FIXED CODE ###

list = list(map(int, input().split()))

temp = 0

for i in range(len(list)):
    for j in range(len(list)-1, i, -1):
        if list[j] < list[j-1]:
            temp = list[j]
            list[j] = list[j-1]
            list[j-1] = temp
    
print(list[0], list[1], list[2])
mport sys
import copy

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B, X] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    if A + B >= X and A <= X:
        print 'YES'
    else:
        print 'NO'

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import copy

def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B, X] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    if A + B >= X and A <= X:
        print 'YES'
    else:
        print 'NO'

if __name__ == '__main__':
    main()
s = input()
print(chr(ord(s)+1))

### FIXED CODE ###

r = int(input())
g = int(input())
print(2*g-r)
s=input()
t=input()
print(sum([1 for index,char in enumerate(s) if p[index]!=char])) 
  

### FIXED CODE ###

s=input()
t=input()
print(sum([1 for index,char in enumerate(s) if t[index]!=char]))
S=list(input())
Q=int(input())
T=[]
for i in range(Q):
  T.append(input().split())
for i in range(Q-1):
  if T[i][0]=="1" and T[i+1][0]=="1":
    T.pop(i)
    T.pop(i)
for i in range(len(T)):
  if T[i][0]=="1":
    S.reverse()
  else:
    if T[i][1]=="1":
      S.insert(0,T[i][2])
    else:
      S.append(T[i][2])
print("".join(S))

### FIXED CODE ###

from collections import deque
S=deque(input())
Q=int(input())
T=[]
m=0
for i in range(Q):
  T.append(input().split())
for i in range(Q):
  if T[i][0]=="1":
    if len(S)>1:
      if m==0:
        m=1
      else:
        m=0
        
  else:
    if T[i][1]=="1":
      if m==0:
        S.appendleft(T[i][2])
      else:
        S.append(T[i][2])
   
    else:
      if m==0:
        S.append(T[i][2])
      else:
        S.appendleft(T[i][2])
if m==0:
  print("".join(S))
else:
  S.reverse()
  print("".join(S))
import numpy as np
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)

D = np.zeros(N).astype(int)
D -= 1
for i in A:
    if D[i] != -1:
        print(D[i])
        continue
    C[i] -= 1
    res = 0
    for value in C.values():
        res += value * (value - 1) // 2
    C[i] += 1
    D[i] = res
    print(res)

### FIXED CODE ###

import numpy as np
from collections import Counter, defaultdict

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)
Normal = defaultdict(int)
Banned = defaultdict(int)

for i in A:
    Normal[i] = C[i] * (C[i]-1) // 2
    Banned[i] = (C[i]-1) * (C[i]-2) // 2
    
Normal_sum = sum(Normal.values())
for i in A:
    print(Normal_sum - (Normal[i] - Banned[i]))
import math

A,B,H,M = map(int,input().split())


if M == 0 and H == 6:

    print(A+B)

elif M == 0 and H == 0:

    print(abs(A-B))

else:

    angulo = abs(11 * M - 60 * H)/2

    angulo = math.radians(angulo)

    print(abs(math.sqrt((A**2 + B ** 2) -  (2 * A * B * math.cos(angulo)))))
~        

### FIXED CODE ###

import math

A,B,H,M = map(int,input().split())


if M == 0 and H == 6:

    print(A+B)

elif M == 0 and H == 0:

    print(abs(A-B))

else:
    angulo = abs(11 * M - 60 * H)/2

    angulo = math.radians(angulo)

    print(abs(math.sqrt((A**2 + B ** 2) -  (2 * A * B * math.cos(angulo)))))
ans = 1
def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
x1, x2 = map(int, input().split())
list = primes(min(x1,x2)+1)
for i in list:
  if x1 % i == 0 and x2 % i == 0:
    ans += 1
    while x1%i == x2%i == 0:
      x1 //= i
      x2 //= i
print(ans)

### FIXED CODE ###

import sys 
input = sys.stdin.readline
a, b = map(int, input().split())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

A = set(prime_factorize(a))
B = set(prime_factorize(b))
ans = A&B
print(len(ans)+1)
import sys
sys.setrecursionlimit(int(1e6))

n=int(input())
l=[[0,0,0]]
for _ in range(n):
    l.append(list(map(int,input().split())))

memo=[[-1,-1,-1] for _ in range(n+1)]
memo[0][0]=0
memo[0][1]=0
memo[0][2]=0
def dp(i,j):
    z[i][j]=1
    if memo[i][j]!=-1:
        return memo[i][j]
    else:
        memo[i][j]=max(dp(i-1,(j+1)%3)+l[i][j],dp(i-1,(j+2)%3)+l[i][j])
        return memo[i][j]
s1=dp(n,0)
s2=dp(n,1)
s3=dp(n,2)
print(max(s1,s2,s3))

### FIXED CODE ###

import sys
sys.setrecursionlimit(int(1e6))

n=int(input())
l=[[0,0,0]]
for _ in range(n):
    l.append(list(map(int,input().split())))

memo=[[-1,-1,-1] for _ in range(n+1)]
memo[0][0]=0
memo[0][1]=0
memo[0][2]=0
def dp(i,j):
    if memo[i][j]!=-1:
        return memo[i][j]
    else:
        memo[i][j]=max(dp(i-1,(j+1)%3)+l[i][j],dp(i-1,(j+2)%3)+l[i][j])
        return memo[i][j]
print(max(dp(n,0),dp(n,1),dp(n,2)))
integer = int(input().split())
conbi = (integer[0] * (integer[0] - 1) + integer[1] * (integer[1] -1 )) / 2
print(conbi)

### FIXED CODE ###

integer = list(map(int, input().split())) 
conbi = (integer[0] * (integer[0] - 1) + integer[1] * (integer[1] -1 ) ) / 2
print(int(conbi))
num = [int(i) for i in input().split()]
K = num[0]
X = num[1]
 
ans = [i for i in range(X-K+1, X+K)]
for i in range(2*K+1):
  print(ans[i], end=' ')

### FIXED CODE ###

num = [int(i) for i in input().split()]
K = num[0]
X = num[1]
 
ans = [i for i in range(X-K+1, X+K)]
for i in range(2*K-1):
  print(ans[i], end=' ')
n,k=map(int,input().split())
a=list(map(int,input().split()))
ans=float("inf")
for i in range(2**n):
    bit=[(i>>j)&1 for j in range(n)]
    if sum(bit)==k and bit[0]:
        cost,kijun=0,a[0]
        for j in range(n):
            if not bit[j]:
                kijun=max(kijun,a[k+1])
            elif a[k+1]>=kijun+1:
                kijun=a[k+1]
            else:
                cost+=kijun+1-a[k+1]
                kijun+=1
        ans=min(ans,cost)
print(ans)

### FIXED CODE ###

def LI(): return list(map(int,input().split()))
N,K = LI()
a = LI()
ans = float('INF')
for i in range(2**(N-1)):
    bit = [i>>j&1 for j in range(N-1)]
    if K-1!=sum(bit):
        continue
    cost,kijun = 0,a[0]
    for k in range(N-1):
        if bit[k]==0:
            kijun = max(kijun,a[k+1])
            continue
        if a[k+1]>=kijun+1:
            kijun = a[k+1]
            continue
        cost += (kijun+1)-a[k+1]
        kijun += 1
    ans = min(ans,cost)
print(ans)
a,b=map(int, input().split())
c=a*b
if c%2 == o:
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

a,b=map(int, input().split())
c=a*b
if c%2 == 0:
  print('Even')
else:
  print('Odd')
a=input()
b=input()
s=int(a)*int(b)
t=(int(a)*2)+(int(b)*2)
print(s, t)


### FIXED CODE ###

a, b = map(int, input().split())
s=int(a)*int(b)
t=(int(a)+int(b))*2
print(s, t)
y = []                                                                                                                  
                                                                                                                        
def slv(x,h,i):                                                                                                         
    if x == h or i >= x:                                                                                                
        if x == h:                                                                                                      
            y.append(i)                                                                                                 
        return                                                                                                          
    slv(x,h+i,i+1) # jump                                                                                               
    slv(x,h,i+1) # stay                                                                                                 
                                                                                                                        
if __name__ == '__main__':                                                                                              
    x = int(input())                                                                                                    
    slv(abs(x),0,0)                                                                                                     
                                                                                                                        
    print(y)                                                                                                            
                                                                                                                        
    if len(y) == 0:                                                                                                     
        print(2)                                                                                                        
    else:                                                                                                               
        print(min(y) - 1)

### FIXED CODE ###

if __name__ == '__main__':
    x = abs(int(input()))

    s = 0
    for i in range(0,10 ** 9):
        if s > x: 
            print(i - 1)
            break
        elif s == x:
            print(i - 1)
            break
        s += i
n=int(input())
r=[]
for i in range(n):
    a,b=map(int,input().split())
    r.append((a,b))
l=[]
for i in range(n):
    c,d=map(int,input().split())
    l.append((c,d))


r.sort()
l.sort(key=lambda x:x[1],reverse=1)
ans=0
for s,t in r.copy():
    for p,q in l.copy():
        if s<p and t<q:
            ans+=1
            r.remove((s,t))
            l.remove((p,q))
print(ans)

### FIXED CODE ###

n=int(input())
x=sorted([tuple(map(int,input().split()))for i in range(n)],key=lambda x:x[1])[::-1]
y=sorted([tuple(map(int,input().split()))for i in range(n)])
#print(x)
#print(y)
ans=0
for j in x.copy():
    for i in y.copy():
        s,t=i
        p,q=j
        if p<s and q<t:
            y.remove((s,t))
            x.remove((p,q))
            #print(p,q,s,t)
            ans+=1
            break
    #print(x,y)
print(ans)
import sys
def input(): return sys.stdin.readline().strip()
import numpy as np


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()
    print(sum(A[:K]))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()


def main():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    A.sort()
    print(sum(A[:K]))


if __name__ == "__main__":
    main()
# c
n = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())
cnt = 0
while B != A:
    for i in range(n):
        a, c = B[i-1], B[(i+1)%n]
        if (B[i] > A[i]) &\
           (B[i] > a) &\
           (B[i] > c):
            B[i] -= (a+c)*((B[i]-A[i]+a+c-1)//(a+c))
            cnt += 1
        elif B[i] < A[i]:
            print(-1)
            exit()
print(cnt)

### FIXED CODE ###

n = int(input())
*A, = map(int, input().split())
*B, = map(int, input().split())
cnt = 0
while B != A:
    for i in range(n):
        a, c = B[i-1], B[(i+1)%n]
        if (B[i] > A[i]) &\
           (B[i] > a) &\
           (B[i] > c):
            d = (B[i]-max(A[i], a, c)+a+c-1)//(a+c)
            B[i] -= (a+c)*d
            cnt += d
        elif B[i] < A[i]:
            print(-1)
            exit()
print(cnt)
# Code for B - Bishop
# Use input() to fetch data from STDIN
from math import ceil
import sys
[H, W] = map(int, input().split())

if H <= 1:
    print(1)
    sys.exit(1)

if W <= 1:
    print(1)
    sys.exit(1)


print(ceil(H * W / 2))


### FIXED CODE ###

# Code for B - Bishop
# Use input() to fetch data from STDIN
from math import ceil
import sys
[H, W] = map(int, input().split())

if H <= 1:
    print(1)
    sys.exit(0)

if W <= 1:
    print(1)
    sys.exit(0)


print(ceil(H * W / 2))
age, price = (int(x) for x in input().split(' '))

if age <= 5:
    print('0')
elif age >= 6 & age <= 12:
    print(f'{price // 2}')
else:
    print(f'{price}')


### FIXED CODE ###

age, price = (int(x) for x in input().split(' '))

if age <= 5:
    print('0')
elif 6 <= age <= 12:
    print('{}'.format(price // 2))
else:
    print('{}'.format(price))
A,B,C,D = map(int,input().split())
 
def gcd( x, y ):
    while y != 0:
        x, y = y, x%y

ctr = 0

tmp1 = A // C
tmp2 = A // D
tmp3 = B // (C * D / gcd(C,D))
tmp4 = B // C
tmp5 = B // D

print(tmp4 + tmp5 - tmp3 - tmp1 -tmp2)



### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd (a, b)

A, B, C, D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)

print((B-A+1) -(b_num - a_num))
a = input()
b = input()
c = input()
x = input()

count = 0

for i_a in range(a):
  for i_b in range(b):
    for i_c in range(c):
      if 500*a + 100*b + 50*c == x:
        count += 1
        
print(count)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())

count = 0

for i_a in range(a + 1):
  for i_b in range(b + 1):
    for i_c in range(c + 1):
      if 500*i_a + 100*i_b + 50*i_c == x:
        count += 1
        
print(count)
S = input()
T = input()

res = len(T)
for i in range(len(S)) :
    for j in range(i,len(S)) :
        if (S[i:j] in T) and (i>=T.index(S[i:j])) :
            diff = len(T) - len(S[i:j])
        if res>=diff :
            res = diff

print(res)

### FIXED CODE ###

D,T,S = map(int,input().split())
if (D/S <= T) :
    print("Yes")
else :
    print("No")
import math

def overlap(p1, p2, d):
    return (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2 <= d

def intersection(o1,o2):
    a  = 2*(o2[0] - o1[0])
    b  = 2*(o2[1] - o1[1])
    c  = (o1[0] - o2[0])*(o1[0] + o2[0]) + (o1[1] - o2[1])*(o1[1] + o2[1])
    a2 = a**2 + b**2
    b2 = a*c + a*b*o1[1] - b**2*o1[0]
    c2 = b**2*(o1[0]**2 + o1[1]**2 - 1) + c**2 + 2*b*c*o1[1]
    x1 = (-b2 + math.sqrt(b2**2 - a2*c2))/a2
    x2 = (-b2 - math.sqrt(b2**2 - a2*c2))/a2
    if b < 0.0001:
        y1 = (o1[1] + o2[1])/2
        y2 = (o1[1] + o2[1])/2
    else:
        y1 = -(a*x1 + c)/b
        y2 = -(a*x2 + c)/b
    if b2**2 - a2*c2 < 0.0001:
        return [x1, y1], [None, None]
    else:
        return [x1, y1], [x2, y2]

while True:
    n = int(input())
    if n == 0:
        break
    p = []
    for i in range(n):
        p.append(list(map(float, input().split(","))))
    ans = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if not overlap(p[i], p[j], 4):
                continue
            elif overlap(p[i], p[j], 0.000001):
                continue
            p1, p2 = intersection(p[i], p[j])
            cnt1 = 0
            cnt2 = 0
            for k in range(n):
                if overlap(p1, p[k], 1):
                    cnt1 += 1
                if p2[0] != None and overlap(p2, p[k], 1):
                    cnt2 += 1
            ans = max([ans, cnt1, cnt2])
    print(ans)



### FIXED CODE ###

import math

def dist(p1, p2):
    return math.sqrt((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)

def intersection(o1,o2):
    if dist(o1,o2) > 2:
        p1, p2 =  [None, None], [None, None]
    elif dist(o1,o2) == 2:
        p1, p2 =  [(o1[0] + o2[0])/2, (o1[1] + o2[1])/2], [None, None]
    else:
        m = [(o1[0] + o2[0])/2, (o1[1] + o2[1])/2]
        v = [m[0] - o1[0], m[1] - o1[1]]
        v_abs = dist(v,[0,0])
        w = [v[1], -v[0]]
        w_abs = dist(w,[0,0])
        n = [w[0]/w_abs, w[1]/w_abs]
        l = math.sqrt(1 - v_abs**2)
        p1 = [m[0] + l*n[0], m[1] + l*n[1]]
        p2 = [m[0] - l*n[0], m[1] - l*n[1]]
    return p1, p2
err = 1.0e-6
while True:
    n = int(input())
    if n == 0:
        break
    p = []
    for i in range(n):
        p.append(list(map(float, input().split(","))))
    ans = 1
    for i in range(n - 1):
        for j in range(i + 1, n):
            p1, p2 = intersection(p[i], p[j])
            cnt1 = 0
            cnt2 = 0
            for k in range(n):
                if p1[0] and dist(p1, p[k]) <= 1 + err:
                    cnt1 += 1
                if p2[0] and dist(p2, p[k]) <= 1 + err:
                    cnt2 += 1
            ans = max([ans, cnt1, cnt2])
    print(ans)
n = [0,0,0]
for i in range(len(n)):
  n[i] = input()
  
tmp = n[0]
n[0] = n[1]
n[1] = tmp

tmp = n[0]
n[0] = n[2]
n[2] = tmp

for i in range(len(n)):
  print(n[i])

### FIXED CODE ###

a,b,c=(int(x) for x in input().split())

a,b = b,a
a,c = c,a

print(a, b, c)
x,y=map(int,input().split())
if x==1 and y==1:
  print(1000000)
elif x<=3 and y>=4:
  print(x*100000)
elif x>=4 and y<=3:
  print(y*100000)
elif x<=3 and y<=3:
  peint(x*100000+y*100000)
else:
  print(0)

### FIXED CODE ###

x,y=map(int,input().split())
if x==1 and y==1:
  print(1000000)
elif x<=3 and y>=4:
  print((x-4)*(-100000))
elif x>=4 and y<=3:
  print((y-4)*(-100000))
elif x<=3 and y<=3:
  print((x-4)*(-100000)+(y-4)*(-100000))
else:
  print(0)
s = input()
print(s[0]+len(s)-2+s[-1])

### FIXED CODE ###

s = input()
print(s[0]+str(len(s)-2)+s[-1])
N = int(input())
d = [int(input()) for i in N]
print(len(set(d)))


### FIXED CODE ###

print(len(set([int(input()) for _ in range(int(input()))])))
n = int(input())
x = list(map(int, input().split()))
a = x[n//2-1]
b = x[n//2+1]
for i in range(n):
  if x[i] <= a:
    print(b)
  else:
    print(a)

### FIXED CODE ###

n = int(input())
x = list(map(int, input().split()))
y = sorted(x)
a = y[n//2-1]
b = y[n//2]
for i in range(n):
  if x[i] <= a:
    print(b)
  else:
    print(a)
n = map(int, input().split())
x = list(map(int, input().split()))
s = math.gcd(x[0],x[1])
for i in x:
    s = math.gcd(s,i)

print(s)

### FIXED CODE ###

import math
n = int(input())
l = [int(i) for i in input().split()]

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y) #再帰定義
s = gcd(l[0],l[1])
for i in l:
    s = gcd(s,i)
   

print(s)
s = [1, 2, 3]
a = int(input())
b = int(input())

_ = s.pop(a)
_ = s.pop(b)

print(s[0])

### FIXED CODE ###

a = int(input())
b = int(input())

for i in range(3):
  if i+1 != a and i+1 != b:
    print(i+1)
l=input()
m=input()
ll=set(l)-sei(m)
lll=set(m)-set(l)
print(["No","Yes"][len(ll)==len(lll)])

### FIXED CODE ###

a=input()
b=input()
dic_a={}
dic_b={}
for i in a:
    if i not in dic_a:
        dic_a[i]=1
    else:
        dic_a[i] += 1
for i in b:
    if i not in dic_b:
        dic_b[i]=1
    else:
        dic_b[i] += 1


print("Yes" if (sorted(dic_a.values())==sorted(dic_b.values())) else "No" )
N = int(input())
nums = [int(i) for i in input().split()]
nums = list((set(nums)))
def compute_divs(n):
    divs = []
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    divs.append(n)
    return divs

if len(nums) == 1: ans = nums[0]
else:
    divs1 = compute_divs(nums[0])
    divs2 = compute_divs(nums[1])
    divs = sorted(list(set(divs1+divs2)))
    print(divs)
    for i in reversed(divs):
        c= 0
        for j in range(len(nums)):
            if nums[j] % i != 0:
                c += 1
                if c == 2:
                    break
        if c <= 1:
            ans = i
            break
print(ans)

### FIXED CODE ###

N = int(input())
nums = [int(i) for i in input().split()]
nums_sorted = sorted(list((set(nums))), reverse=True)
def compute_divs(n):
    divs = []
    if n == 1: return [1]
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            divs.append(i)
            if i != n // i:
                divs.append(n//i)
    divs.append(n)
    return divs
ans = 1
if len(nums_sorted) == 1: ans = nums[0]
else:
    divs1 = compute_divs(nums_sorted[0])
    divs2 = compute_divs(nums_sorted[1])
    divs = sorted(list(set(divs1+divs2)))
    for i in reversed(divs):
        c= 0
        for j in nums:
            if j % i != 0:
                c += 1
                if c == 2:
                    break
        if c <= 1:
            ans = i
            break
print(ans)
s=input()
a=s[:1]
b=s[2:]
if (1<=a<=12 and 1<=b<=12):
  print('AMBIGUOUS')
elif (1<=a<=12 and (b=0 or 13<b):
      print('MMYY')
elif (1<=b<=12 and (a=0 or 13<a):
      print('YYMM')
else:
      print('NA')

### FIXED CODE ###

s=input()
a=int(s[:2])
b=int(s[2:])
if (1<=a<=12)and(1<=b<=12):
  print('AMBIGUOUS')
elif (1<=a<=12)and(b==0 or b>12):
  print('MMYY')
elif (a==0 or a>12)and(1<=b<=12):
  print('YYMM')
else:
  print('NA')