Harryxun/stf_run huggingface dataset:
# ABC060b
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

a, b, c = map(int, input().split())

print('YES' if c % math.gcd(a, b) == 0 else 'NO')

### FIXED CODE ###

# ABC060b
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

a, b, c = map(int, input().split())

for i in range(a, a * b+a, a):
    if (i % b == c):
        #print(i, b, i % b, c)
        print('YES')
        exit()
print('NO')
#156_B
n, k = map(int, input().split())
for i in range(30):
    if k ** i > n:
        ans = i
        break
print(ans)

### FIXED CODE ###

#156_B ans
n, k = map(int, input().split())
ans = 0
while n > 0:
    n = n // k
    ans += 1
print(ans)
from math import factorial

N = int(input())
D = {}
L = [[]for _ in range(N)]
count = 0
for i in range(N):
    L[i] = list(input())
    L[i].sort()
    L[i] = tuple(L[i])
    if L[i] in D:
        D[L[i]] = D[L[i]] + 1
        if D[L[i]] == 2:
            D[L[i]] = D[L[i]] + 1
    else:
        D[L[i]] = 0
for key in D:
    if D[key] > 2:
        #count += factorial(D[key]) / factorial(2) / factorial(D[key]-2)
    else:
        count += D[key]

print(int(count))


### FIXED CODE ###

from math import factorial
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


N = int(input())
D = {}
L = [[]for _ in range(N)]
count = 0
for i in range(N):
    L[i] = list(input())
    L[i].sort()
    L[i] = tuple(L[i])
    if L[i] in D:
        D[L[i]] = D[L[i]] + 1
        if D[L[i]] == 2:
            D[L[i]] = D[L[i]] + 1
    else:
        D[L[i]] = 0
for key in D:
    if D[key] > 2:
        count += cmb(D[key],2)
    else:
        count += D[key]

print(count)
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <cstdlib>
#include <iomanip>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i){
        int p;
        cin >>p;
        a[i] = p;
    }
    int sum = 0;
    int yasui = 100000;
    for(int i = 0; i < n; ++i){
        sum += a[i];
        if(yasui > a[i]) yasui = a[i];
    }
    cout << sum - yasui/2 << endl;
}


### FIXED CODE ###

N = int(input())
p = [int(input()) for x in range(N)]
print(int(sum(p)-max(p)/2))
x=input()
x[3]=8
print(x)

### FIXED CODE ###

print("2018/01/"+input()[-2:])
import copy
n=int(input())
a=[]
b=[]
c=[]
d=[]
for i in range(n):
  a.append(i+1)
for i in range(n):
  if 3*i+2>n:
    break
  else:
    b.append(a[3*i+2])
for i in range(n):
  if 5*i+4>n:
    break
  else:
    c.append(a[5*i+4])
for i in range(n):
  if 15*i+14>n:
    break
  else:
    d.append(a[15*i+14])
print(sum(a)-sum(b)-sum(c)+sum(d))

### FIXED CODE ###

n=int(input())
a=0
for i in range(1,n+1):
  if i%3!=0 and i%5!=0:
    a=a+i
print(a)
l = raw_input().split(" ")


a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]

ans="NO"

if (l[0] in a and l[1] in a):
    ans="YES"
if (l[0] in b and l[1] in b):
    ans="YES"
if (l[0] in c and l[1] in c):
    ans="YES"

print(ans)


### FIXED CODE ###

l = raw_input().split(" ")
#print(l[0])
#print(l[1])

a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]

ans="No"


if (int(l[0]) in a and int(l[1]) in a):
    ans="Yes"

if (int(l[0]) in b and int(l[1]) in b):
    ans="Yes"

if (int(l[0]) in c and int(l[1]) in c):
    ans="Yes"

print(ans)
s=input()
le=len(s)
lis=[]
for i in range(0,le):
  if s[i]!="A" and s[i]!="" and s[i]!="T" and s[i]!="G":
    lis.append(i)
lo=0
for j in range(0,len(lis)-1):
  if lis[j+1]-lis[j]-1>=lo:
    lo=lis[j+1]-lis[j]-1
if lis[0]>=lo:
  lo=lis[j]
if le-lis[-1]-1>=lo:
  lo=le-lis[-1]-1
print(lo)

### FIXED CODE ###

b=input()
if b=="A":
  print("T")
if b=="T":
  print("A")
if b=="C":
  print("G")
if b=="G":
  print("C")
n, m = [int(x) for x in input().split()]
isl = []
mark = [False] * n
l = [0] * n
for i in range(n):
    isl.append([])
for i in range(m):
    a, b = [int(x) for x in input().split()]
    isl[a - 1].append(b - 1)
    isl[b - 1].append(a - 1)
 
q = []
q.append(0)
found = False
while len(q):
    v = q.pop()
    mark[v] = True
    for child in isl[v]:
        if not mark[child]:
            l[child] = l[v] + 1
            q.append(child)
print("POSSIBLE" if (l[n - 1] == 2 or l[n - 1] == 1) else "IMPOSSIBLE")

### FIXED CODE ###

a = input()
print("ABC" + str(a))
a, b = map(int, input().split())

if a == 0:
  if b == 100:
    print(101)
  else:
    print(b)
else:
  if b == 100:
    print(101*10**a)
  else:
    printe(b*10**a)

### FIXED CODE ###

a, b = map(int, input().split())

if a == 0:
  if b == 100:
    print(101)
  else:
    print(b)
else:
  if b == 100:
    print(101*100**a)
  else:
    print(b*100**a)
orders = {
    'North': (2, 6, 3, 4, 1, 5),
    'East': (4, 2, 1, 6, 5, 3),
    'West': (3, 2, 6, 1, 5, 4),
    'South': (5, 1, 3, 4, 6, 2),
    'Right': (1, 3, 5, 2, 4, 6),
    'Left': (1, 4, 2, 5, 3, 6)
}

while True:
    n = int(input())
    if not n:
        exit()
        break
    dice = list(range(1, 7))
    top = 1

    while n:
        dice = [dice[s - 1] for s in orders[input()]]
        top += dice[0]
        n -= 1
    print(top)

### FIXED CODE ###

orders = {
    'North': (2, 6, 3, 4, 1, 5),
    'East': (4, 2, 1, 6, 5, 3),
    'West': (3, 2, 6, 1, 5, 4),
    'South': (5, 1, 3, 4, 6, 2),
    'Right': (1, 3, 5, 2, 4, 6),
    'Left': (1, 4, 2, 5, 3, 6)
}

while True:
    n = int(input())
    if not n:
        break
    dice = list(range(1, 7))
    top = 1

    while n:
        dice = [dice[s - 1] for s in orders[input().strip()]]
        top += dice[0]
        n -= 1
    print(top)
n,a,b = list(map(int,input().split()))
kumiawase_bunshi = 1
kumiawase_bunbo = 1
t=0
ans = 0
for i in range (1,n+1):
    if(i != a and i != b):
        t=n
        for j in range (n-i+1,n+1):
            kumiawase_bunshi = kumiawase_bunshi * j
        for k in range (1,i+1):
            kumiawase_bunbo = kumiawase_bunbo * k
        ans = ans + (kumiawase_bunshi / kumiawase_bunbo)
        kumiawase_bunshi = 1
        kumiawase_bunbo = 1
ans = ans % 1000000007
print(ans)

### FIXED CODE ###

def choose(n,r):
    res = 1
    fac = 1
    for i in range(r):
        res *= n-i
        res %= MOD
        fac *= i+1
        fac %= MOD
    return res*pow(fac,MOD-2,MOD)%MOD        

n,a,b = list(map(int,input().split()))
MOD = 10**9+7
t=0
ans = pow(2,n,MOD)-1


ans -= choose(n,a)
ans -= choose(n,b)

ans = ans % MOD
print(int(ans))
for i in range(0, 3000):
    array = map(int, input().split(' '))
    if array[0] == 0 and array[1] == 0:
        break
    else:
        print(' '.join(map(str, sorted(array))))


### FIXED CODE ###

for i in range(0, 3000):
    array = [int(x) for x in input().split(' ')]
    if array[0] == 0 and array[1] == 0:
        break
    else:
        print(' '.join([str(x) for x in sorted(array)]))
def bfs(graph, start, goal, connection):
    visited = {start: None}
    unvisited = [start]
    while unvisited:
        now = unvisited[0]
        if now == goal or (1000000*now + goal) in connection:
            connection[1000000*start + goal] = 1
            return "yes"
        unvisited = unvisited[1:]
        for next in graph[now]:
            if not (next in visited):
                unvisited.append(next)
                visited[next] = now
    return "no"

n, m = map(int, input().split())
g = [None]*n
c = {}

for i in range(m):
    inp = list(map(int, input().split()))
    g[inp[0]].append(inp[1])
    g[inp[1]].append(inp[0])

q = int(input())

for i in range(q):
    s, t = map(int, input().split())
    print(bfs(g, s, t, c))

### FIXED CODE ###

from collections import deque

def bfs(graph, start):
    visited = {start: None}
    unvisited = deque()
    unvisited.append(start)
    while unvisited:
        now = unvisited.popleft()
        for next in graph[now]:
            if not (next in visited):
                unvisited.append(next)
                visited[next] = now
    return visited

n, m = map(int, input().split())
g = [set() for i in range(n)]
group = []

for i in range(m):
    a, b = map(int, input().split())
    g[a].add(b)
    g[b].add(a)

q = int(input())

for i in range(q):
    s, t = map(int, input().split())
    for j in range(len(group)):
        if s in group[j] and t in group[j]:
            print("yes")
            break
        elif s in group[j]:
            print("no")
            break
    else:
        group_tmp = set(bfs(g, s).keys())
        if t in group_tmp:
            print("yes")
        else:
            print("no")
        group.append(group_tmp)
tmp_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(tmp_list[input()-1])

### FIXED CODE ###

str_K = input()
k = int(str_K)
tmp_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(tmp_list[k-1])
n,m = import math
n,m = map(int,input().split())
print(math.factorial(n)+math.factorial(m))

### FIXED CODE ###

import math
n,m = map(int,input().split())
n2 = n*(n-1)/2
m2 = m*(m-1)/2

print(round(n2+m2))
while 1:
    N,M = map(int,raw_input().split())
    if N == 0: break
    h = [int(raw_input()) for _ in range(N)]
    w = [int(raw_input()) for _ in range(M)]
    ans = 0
    H,W = h[:],w[:]
    for i in range(N):
        s = h[i]
        for j in range(i+1,N):
            s += h[j]
            H.append(s)
    for i in range(M):
        s = w[i]
        for j in range(i+1,N):
            s += w[j]
            W.append(s)
    for hi in H:
        for wi in W:
                if hi == wi: ans += 1
    print ans

### FIXED CODE ###

from collections import defaultdict

def getArray(a):
    d = defaultdict(int)
    n = len(a)
    for i in range(n):
        s = 0
        for j in range(i,n):
            s += a[j]
            d[s] += 1
    return d

while 1:
    N,M = map(int,raw_input().split())
    if N == 0: break
    h = [int(raw_input()) for _ in xrange(N)]
    w = [int(raw_input()) for _ in xrange(M)]
    H,W = getArray(h),getArray(w)
    print sum(H[hi]*W[hi] for hi in H)
a = input()
b = a % 1000
print(b)

### FIXED CODE ###

N = int(input())
if N % 1000 == 0:
  print(0)
else:
  a = N % 1000
  print(1000 - a)
gaps = [1,2,2,4,2,4,2,4,6,2,6]
    length, cycle = 11, 3
    f, fs, nxt = 2, [], 0
    while f * f <= n:
        while n % f == 0:
            fs.append(f)
            n /= f
        f += gaps[nxt]
        nxt += 1
        if nxt == length:
            nxt = cycle
    if n > 1: fs.append(n)
    return fs

import itertools
from itertools import combinations, chain
import copy 

# def powerset(L):
#   pset = set()
#   for n in range(len(L) + 1):
#     for sset in itertools.combinations(L, n):
#       pset.add(sset)
#   return pset
def powerset(iterable):
    "powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)"
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))
    
def list_diff(first, second):
        first = copy.copy(first)
        for s in second:
            first.remove(s)
        return first

def prod(lst):
    ret = 1
    for a in lst:
        ret *= a
    return ret

def sup(x):
    return [sorted(x[:i]+x[i+s:]) for i in range(len(x)) for s in range(len(x))]

def main():
    N = int(input())
    facs = factors(N)
    # st = powerset(facs)
    st=sup(facs)

    mn_ij = 10**12
    for i in st:
        i = list(i)
        j = list_diff(facs, i)
        i, j = prod(i), prod(j)

        mn_ij = min(mn_ij, i+j)

    # print(list(map(len,[ st, facs]) ))
    print(int(mn_ij-2))

if __name__ == "__main__":
    main()


### FIXED CODE ###

import math

def main():
    N = int(input())
    rt_N = math.ceil(math.sqrt(N))

    mn_ij = 10**12
    for i in range(1, rt_N+1):
        if N % i == 0:
            j = N // i

            mn_ij = min(mn_ij, i+j)
        
        mn_ij = min(mn_ij, i+j)

    # print(list(map(len,[ st, facs]) ))
    print(int(mn_ij-2))

if __name__ == "__main__":
    main()
map(int,input().split(' '))
A = list(map(int,input().split(' ')))
B =[]
C =[]

l = [list(map(int,input().split())) for i in range(M)]

A.sort()
l = sorted(l,key = lambda x:x[1])

ttl = 0
m_score = 0
flag =False
for i in l[::-1]:
    p = i[0]
    k = i[1]
    ttl+=p
    t = ttl-1
    if t>=N:
        t = N-1
    if A[t]<k:
        m_score += p*k
        continue
    else:
        for n,j in enumerate(A[t-p+1:t+1]):
            if j>k:
                flag = True
                break
        if flag:
            m_score += k*n+sum(A[t-p+1+n:])
            break
if not flag:
    if ttl<N:
        m_score += sum(A[ttl:])
print(m_scor

### FIXED CODE ###

N,M = map(int,input().split(' '))
A = list(map(int,input().split(' ')))
l = [list(map(int,input().split())) for i in range(M)]

A.sort()
l = sorted(l,key = lambda x:x[1])

ind =0
for b,c in l[::-1]:
    mx = min(N,ind+b)
    for i in range(ind,mx):
        if c>A[i]:
            A[i] = c
    if mx==N:
        break
    ind += b
print(sum(A))
while True:
    x,y=sorted([int(x) for x in input().split])
    if x==0 and y==0: break
    print(x,y)



### FIXED CODE ###

while True:
 a,b=sorted([int(x) for x in input().split()])
 if a==0 and b == 0 : break
 print(a,b)
#include<iostream>
#include<vector>
#include<bitset>
#include<algorithm>
#include<cmath>

using namespace std;
typedef vector< vector<int> > vv;

int main(){
  int n;cin >> n;
  vv f(n,vector<int>(10,0));
  for(int i=0;i<n;i++)for(int j=0;j<10;j++)cin >> f[i][j];
  vv p(n,vector<int>(11,0));
  for(int i=0;i<n;i++)for(int j=0;j<=10;j++)cin >> p[i][j];
  int ma=-1000000000;
  int bits=pow(2,10);
  for(int i=1;i<bits;i++){
    bitset<10> bit(i);
    vector<int> v(n);
    for(int j=0;j<10;j++){
      if(bit[j]){
        for(int k=0;k<n;k++){
          v[k]+=f[k][j];
        }
      }
    }
    int ma_sub=0;
    for(int l=0;l<n;l++){
      ma_sub+=p[l][v[l]];
    }
    ma=max(ma,ma_sub);
  }
  cout << ma << endl;
}


### FIXED CODE ###

n=int(input())
f=[list(map(int,input().split())) for i in range(n)]
p=[list(map(int,input().split())) for i in range(n)]
ma=-10000000000000
for i in range(1,2**10):
    check=[0]*n
    for j in range(10):
        if (i>>j) & 1:
            for k in range(n):
                check[k]+=f[k][j]
    ma_sub=0
    for i in range(n):
        ma_sub+=p[i][check[i]]
    ma=max(ma,ma_sub)
print(ma)
kind,kona = map(int,input().split())

grum = []
sum_grum=0

for i in range(kind):
    grum.append(input())
for j in range(kind):
    sum_grum = sum_grum+int(grum[j])

kona = kona - sum_grum
minimun = int(min(grum))

if kona>=minimun:
    kona_sec = kona//minimun

print(kind+kona_sec)


### FIXED CODE ###

order= input().strip()
count = 0
for i in range (3):
    if order[i]=='o':
        count=count+100

print(700+count)
import sys
 
readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)
 
 
def main():
    from collections import Counter
 
    N = int(readline())
    a = list(map(int, readline().split()))
    b = list(map(int, readline().split()))
 
    cnt_a = Counter(a)
    cnt_b = Counter(b)
 
    acc_a = [0] * 200001
    acc_b = [0] * 200001
 
    for i in range(1, 200001):
        acc_a[i] = acc_a[i - 1] + cnt_a[i]
        acc_b[i] = acc_b[i - 1] + cnt_b[i]
        if cnt_a[i] + cnt_b[i] > N:
            return print("No")
 
    ans = 0
    for i in range(200000, 0, -1):
        score = acc_b[i] - acc_a[i - 1]
        ans = max(ans, score)
 
    print("Yes")
 
    res = b[ans:] + b[:ans]
    print(*res)
 
if __name__ == '__main__':
    main()
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter

    N = int(readline())
    a = list(map(int, readline().split()))
    b = list(map(int, readline().split()))

    cnt_a = Counter(a)
    cnt_b = Counter(b)

    acc_a = [0] * 200001
    acc_b = [0] * 200001

    for i in range(1, 200001):
        acc_a[i] = acc_a[i - 1] + cnt_a[i]
        acc_b[i] = acc_b[i - 1] + cnt_b[i]
        if cnt_a[i] + cnt_b[i] > N:
            return print("No")

    ans = 0
    for i in range(200000, 0, -1):
        score = acc_b[i] - acc_a[i - 1]
        ans = max(ans, score)

    print("Yes")

    res = b[ans:] + b[:ans]
    print(*res)

if __name__ == '__main__':
    main()
Submission Info
Sub

### FIXED CODE ###

import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    from collections import Counter

    N = int(readline())
    a = list(map(int, readline().split()))
    b = list(map(int, readline().split()))

    cnt_a = Counter(a)
    cnt_b = Counter(b)

    acc_a = [0] * 200001
    acc_b = [0] * 200001

    for i in range(1, 200001):
        acc_a[i] = acc_a[i - 1] + cnt_a[i]
        acc_b[i] = acc_b[i - 1] + cnt_b[i]
        if cnt_a[i] + cnt_b[i] > N:
            return print("No")

    ans = 0
    for i in range(200000, 0, -1):
        score = acc_b[i] - acc_a[i - 1]
        ans = max(ans, score)

    print("Yes")

    res = b[ans:] + b[:ans]
    print(*res)

if __name__ == '__main__':
    main()
x, a=map(int, input().split())
if	x < a
	l = 0
else
	l = 10
print(l)

### FIXED CODE ###

x, a=map(int, input().split())
if	x < a:
	l = 0
else:
	l = 10
print(l)
o=input()
e=input()
l=0
if abs(o-e)==0:
    for i in range(len(e)):
        l+=o[i]+e[i]
    print(l)
else:
    for j in range(len(e)):
        l+=o[i]+e[i]
    l+=o[len(e)]
    print(l)

### FIXED CODE ###

o=input()
e=input()
s=""
if len(o)==len(e):
    for i in range(len(o)):
        s+=o[i]
        s+=e[i]
else:
    for j in range(len(e)):
        s+=o[j]
        s+=e[j]
    s+=o[len(e)]
print(s)
n = int(input())

for j in range(n):
    b = int(input())
    for j in range(3):
        if A[j][0] == b:
            A[j][0] = 0
        if A[j][1] == b:
            A[j][1] = 0
        if A[j][2] == b:
            A[j][2] = 0

for k in range(3):
    if A[k][0]==A[k][1]==A[k][2]==0:
        print("Yes")
    elif A[0][k]==A[1][k]==A[2][k]==0:
        print("Yes")
        exit
if A[0][0]==A[1][1]==A[2][2]==0:
    print("Yes")
elif A[0][2]==A[1][1]==A[2][0]==0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
n = int(input())

for i in range(n):
    b = int(input())
    for j in range(3):
        if A1[j] == b:
            A1[j] = 0
        if A2[j] == b:
            A2[j] = 0
        if A3[j] == b:
            A3[j] = 0

if A1[0]==A1[1]==A1[2]==0:
    print("Yes")
    exit
elif A2[0]==A2[1]==A2[2]==0:
    print("Yes")
    exit
elif A3[0]==A3[1]==A3[2]==0:
    print("Yes")
    exit

elif A1[0]==A2[0]==A3[0]==0:
    print("Yes")
    exit
elif A1[1]==A2[1]==A3[1]==0:
    print("Yes")
    exit
elif A1[2]==A2[2]==A3[2]==0:
    print("Yes")
    exit
    
elif A1[0]==A2[1]==A3[2]==0:
    print("Yes")
    exit
elif A1[2]==A2[1]==A3[0]==0:
    print("Yes")
    exit
else:
    print("No")
H, W = map(int, input().split())
S = [input() for y in range(H)]
visited = [[False] * W for y in range(H)]

def color(y, x):
    if y < 0 or H <= y or x < 0 or W <= x or visited[y][x]:
        return "@"
    else:
        return S[y][x]


def dfs(y, x):
    b = 0
    w = 0
    nxt = "n"
    if color(y, x) == ".":
        w = 1
        nxt = "#"
    elif color(y, x) == "#":
        b = 1
        nxt = "."
    
    visited[y][x] = True
    if color(y - 1, x) == nxt:
        _b, _w = dfs(y - 1, x)
        b += _b
        w += _w
    if color(y + 1, x) == nxt:
        _b, _w = dfs(y + 1, x)
        b += _b
        w += _w
    if color(y, x - 1) == nxt:
        _b, _w = dfs(y, x - 1)
        b += _b
        w += _w
    if color(y, x + 1) == nxt:
        _b, _w = dfs(y, x + 1)
        b += _b
        w += _w

    return (b, w)

    
ans = 0
for y in range(H):
    for x in range(W):
        b, w = dfs(y, x)
        ans += b * w

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(300000)

H, W = map(int, input().split())
S = [input() for y in range(H)]
visited = [[False] * W for y in range(H)]

def color(y, x):
    if y < 0 or H <= y or x < 0 or W <= x or visited[y][x]:
        return "@"
    else:
        return S[y][x]


def dfs(y, x):
    b = 0
    w = 0
    nxt = "n"
    if color(y, x) == ".":
        w = 1
        nxt = "#"
    elif color(y, x) == "#":
        b = 1
        nxt = "."
    
    visited[y][x] = True
    if color(y - 1, x) == nxt:
        _b, _w = dfs(y - 1, x)
        b += _b
        w += _w
    if color(y + 1, x) == nxt:
        _b, _w = dfs(y + 1, x)
        b += _b
        w += _w
    if color(y, x - 1) == nxt:
        _b, _w = dfs(y, x - 1)
        b += _b
        w += _w
    if color(y, x + 1) == nxt:
        _b, _w = dfs(y, x + 1)
        b += _b
        w += _w

    return (b, w)

    
ans = 0
for y in range(H):
    for x in range(W):
        b, w = dfs(y, x)
        ans += b * w

print(ans)
from collections import defaultdict
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]

    ab = defaultdict(list)
    for a, b in AB:
        ab[a].append(b * -1)

    ans = 0
    flag = 1
    for i in range(1, M + 1):
        if flag:
            reward = heapify(ab[1])
            flag = 0
        if ab[i]:
            for n in ab[i]:
                heappush(reward, n * -1)
            ans += heappop(reward) * -1
    print(ans)

input = lambda: stdin.readline()
main()


### FIXED CODE ###

from collections import defaultdict
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    N, M = map(int, input().split())
    AB = [tuple(map(int, input().split())) for _ in [0] * N]

    ab = defaultdict(list)
    for a, b in AB:
        ab[a].append(b)

    ans = 0
    reward = []
    for i in range(1, M + 1):
        if ab[i]:
            for n in ab[i]:
                heappush(reward, n * -1)
        if reward:
            ans += heappop(reward) * -1
    print(ans)

input = lambda: stdin.readline()
main()
n, d = map(int, input().split())
i = (d * 2) + 1
if n % i == 0 :
  print(n / i)
else :
  print((n // i) + 1)


### FIXED CODE ###

r = int(input())
print(3 * r * r)
import collections as cl
N = int(input())
a_li = [i for i in input().split()]
c = cl.Counter(a_li)
print(c)
# for k in list(c.keys())[:-2] :
keys = list(c.keys())
max_sum = 0
if (len(c) == 1) :
    print(1)
elif (len(c) == 2) :
    if (abs(a_li[0] - a_li[1]) <= 1 ) :
        print(2)
    else :
        print(1)
else :
    for k in range(len(c) -2 ) :
        sum_v = c[keys[k]] + c[keys[k+1]] + c[keys[k+2]]
        if (max_sum < sum_v) :
            max_sum = sum_v
    
    print(max_sum)





### FIXED CODE ###

import collections as cl
N = int(input())
a_li = [int(i) for i in input().split()]
a_li2 = [i-1 for i in a_li]
a_li3 = [i+1 for i in a_li]
a_li.extend(a_li2)
a_li.extend(a_li3)
c = cl.Counter(a_li)
print(c.most_common()[0][1])

# keys = list(c.keys())
# max_sum = 0
# if (len(c) == 1) :
#     # 1種類しかない
#     print(len(a_li))
# elif (len(c) == 2) :
#     # 2種類ある
#     if (abs(int(keys[0]) - int(keys[1])) <= 2 ) :
#         # 差が2以下なら全部同じ値にできる
#         print(len(a_li))
#     else :
#         # 差が2より大きいなら多いほうの個数が最大
#         if (int(c[keys[0]]) > int(c[keys[1]])) :
#             print(c[keys[0]])
#         else :
#             print(c[keys[1]])
# else :
#     # この思想はNG。keys[k]からkeys[k+2]の差が2以下じゃないと成り立たない。
#     for k in range(len(c) -2 ) :
#         sum_v = c[keys[k]] + c[keys[k+1]] + c[keys[k+2]]
#         if (max_sum < sum_v) :
#             max_sum = sum_v
    
#     print(max_sum)
x=raw_input().split()

for i in reversed(range(len(x)):
print x[i]

### FIXED CODE ###

n = int(raw_input())
a = map(int,raw_input().split())
a.reverse()
for i in a:
    print i,