Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
a = [int(x) for x in input().split(' ')]
# a = [int(input()) for x in range (n)]

b = [0] * n
if(a[0] > a[-1]) : mi = a[-1]
else : mi = a[-0]


for x in range(mi*2, -1,-2) :
    # print(x)
    b[0] = x

    for i in range(1,n) :
        b[i] = 2 * a[i-1] - b[i-1]
        # print(b)
        if (b[i] < 0) : 
            break

    else :
        if (b[-1] + b[0] == 2 * a[-1]) :
            break


s = ""
for i in b :
    s = s + str(i) + " " 


print(s)

### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split(' ')]

b = [0] * n
if(a[0] > a[-1]) : mi = a[-1]
else : mi = a[0]

aa = 0
for i in range(1, n, 2) :
    aa += a[i]
b[0] = sum(a) - 2 * aa

for i in range(1,n) :
    b[i] = 2 * a[i-1] - b[i-1]
print(str(b).strip("[]").replace(",",""))
### BUGGY CODE ###

import sys


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


sys.setrecursionlimit(20000000)
MOD = 10 ** 9 + 7


def main():
    L = list(input())

    def power(a, n):
        x = 1
        while n:
            if n & 1:
                x = x * a % MOD
            n >>= 1
            a = a * a % MOD
        return x

    pow = [0] * (len(L) + 1)
    pow[0] = 1
    for i in range(1, len(L) + 1):
        pow[i] = pow[i - 1] * 3

    def cnt(s):
        if len(s) == 1:
            if s[0] == "1":
                return 3
            else:
                return 1
        if s[0] == "0":
            return cnt(s[1:]) % MOD
        else:
            return (cnt(s[1:]) * 2) % MOD + pow[len(s) - 1]

    answer = cnt(L) % MOD

    print(answer)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import queue


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


sys.setrecursionlimit(20000000)
MOD = 10 ** 9 + 7


def main():
    L = list(input())

    pow = [0] * (len(L) + 1)
    pow[0] = 1
    for i in range(1, len(L) + 1):
        pow[i] = pow[i - 1] * 3 % MOD
    N = len(L)
    if L[-1] == "0":
        answer = 1
    else:
        answer = 3
    for i in range(1, N):
        if L[N - i - 1] == "1":
            answer = answer * 2 + pow[i]
            answer %= MOD
        else:
            continue
    print(answer)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readlines = sys.stdin.buffer.readlines
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)

OFS = 100005
N = int(input())
G = [[] for _ in [0]*OFS*2]
for line in readlines():
    x, y = map(int, line.split())
    y += OFS
    G[x].append(y)
    G[y].append(x)

visited = [0]*OFS*2


def dfs(v, x=0, y=0):
    if v < OFS:
        x += 1
    else:
        y += 1

    for u in G[v]:
        if visited[u]:
            continue
        visited[u] = 1
        x, y = dfs(u, x, y)

    return x, y


ans = 0
for i in range(OFS):
    if visited[i]:
        continue
    visited[i] = 1
    x, y = dfs(i)
    ans += x*y

print(ans - N)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readlines = sys.stdin.buffer.readlines
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)


def main():
    OFS = 100005
    N = int(input())
    G = [[] for _ in [0]*OFS*2]
    for line in readlines():
        x, y = map(int, line.split())
        y += OFS
        G[x].append(y)
        G[y].append(x)

    def dfs(v):
        if v < OFS:
            counter[0] += 1
        else:
            counter[1] += 1

        for u in G[v]:
            if visited[u]:
                continue
            visited[u] = 1
            dfs(u)

    visited = [0]*OFS*2
    ans = 0
    for i in range(OFS):
        if visited[i]:
            continue
        counter = [0]*2
        visited[i] = 1
        dfs(i)
        ans += counter[0] * counter[1]

    print(ans - N)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
d = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
ans = ''
for i in range(m):
  if t[i] in d:
    d.pop(d.index(t[i]))
  else:
    ans = 'NO'
    break
if ans == '':
  ans = 'YES'
print(ans)

### FIXED CODE ###

import collections
n = int(input())
d = list(map(str, input().split()))
m = int(input())
t = list(map(str, input().split()))
c_d = collections.Counter(d)
c_t = collections.Counter(t)
ans = ''
for e in c_t:
  if c_t[e] <= c_d[e]:
    next
  else:
    ans = 'NO'
if ans == '':
  ans = 'YES'
print(ans)
### BUGGY CODE ###

# -*- coding:utf-8 -*-
import itertools
N, P = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
odd = [ tmp for tmp in a if tmp%2 != 0]
even = [ tmp for tmp in a if tmp%2 == 0]
b = []
c = []
if P == 0:
    ans += 1
    for tmp in range(2, len(odd)+1, 2):
        b.append(len(list(itertools.combinations(odd,tmp))))
else:
    for tmp in range(1, len(odd)+1, 2):
        b.append(len(list(itertools.combinations(odd, tmp))))

for tmp in range(1, len(even)+1):
    c.append(len(list(itertools.combinations(even, tmp))))
for tmp in c:
    for tmp2 in b:
        ans += tmp*tmp2

if P == 0:
    ans += sum(b)+sum(c)
else:
    ans += sum(b)

print(ans)

### FIXED CODE ###

# -*- coding:utf-8 -*-
import itertools, math
N, P = map(int, input().split())
a = list(map(int, input().split()))
ans = 0
odd = [ tmp for tmp in a if tmp%2 != 0]
even = [ tmp for tmp in a if tmp%2 == 0]
d = math.factorial(len(odd))
e = math.factorial(len(even))
if P == 0:
    ans += 1
    b = sum([ (d//math.factorial(len(odd)-tmp))//math.factorial(tmp) for tmp in range(2, len(odd)+1, 2) ])
else:
    b = sum([ (d//math.factorial(len(odd)-tmp))//math.factorial(tmp) for tmp in range(1, len(odd)+1, 2) ])
c = [ (e//math.factorial(len(even)-tmp))//math.factorial(tmp) for tmp in range(1, len(even)+1) ]
for tmp in c:
    ans += tmp*b
else:
    if P == 0:
        ans += b+sum(c)
    else:
        ans += b
print(ans)
### BUGGY CODE ###

from numpy import*
a,b=loadtxt(open(0),'i',skiprows=1)
c=0
l=2**29
while l:u=l;l//=2;c+=sum(diff(searchsorted(sort(hstack((b%u-u,b%u))),[[u],[l]]-a%u).T))%2*l
print(c)

### FIXED CODE ###

from numpy import*;B=searchsorted;a,b=loadtxt(open(0),'i',skiprows=1);c=0;l=2**29
while l:h=l;l//=2;y=sort(hstack((b%h-h,b%h)));c+=sum(B(y,h-a%h)-B(y,l-a%h))%2*l
print(c)
### BUGGY CODE ###

n = int(input())
l = list(map(int, input().split()))
 
l.sort()
count = 0
 
for i in range(n) :
    for j in range(1, n - i) :
        for k in range(1, n - i - j) :
            if l[i] + l[i + j] > l[i + j + k] :
                count += 1
 
print(count)

### FIXED CODE ###

from bisect import bisect_left

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

l.sort()
count = 0

for i in range(n - 2) :
    for j in range(i + 1, n - 1) :
        idx = bisect_left(l, l[i] + l[j])
        count += idx - (j + 1)

print(count)
### BUGGY CODE ###

def dec(a):
    res = []
    for i in range(1,int(a**0.5+1)):
        if a%i==0:
            res.append(i)
            res.append(a//i)
    return res

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

    d = {}
    for i in range(N):
        if A[i] not in d:
            d[A[i]] = 1
        else:
            d[A[i]] += 1

    ans = N
    for i in range(N):
        dl = dec(A[i])
        for a in dl:
            if a in d:
                if a==A[i]:
                    if d[a]>1:
                        ans -= 1
                        break
                else:
                    ans -= 1
                    break

    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
A.sort()
count = defaultdict(lambda:0)
for a in A:
    count[a] += 1
dp = [True]*(A[-1]+1)

ans = 0
for a in A:
    if dp[a] and count[a]==1:
        ans += 1
    for i in range(1,len(dp)):
        if a*i>A[-1]:
            break
        dp[a*i] = False

print(ans)
### BUGGY CODE ###

def shellsort(a):
    l = len(a)
    intervals = [n for n in (40, 13, 4, 1) if n <= l]
    count = 0
    for interval in intervals:
        for i in range(interval, l):
            j = 0
            while i-interval*(j+1) >= 0:
                n, m = i-interval*j, i-interval*(j+1)
                if a[n] < a[m]:
                    a[n], a[m] = a[m], a[n]
                    j += 1
                    count += 1
                else:
                    break

    print(len(intervals))
    print(" ".join([str(n) for n in intervals]))
    print(count)
    print("\n".join([str(n) for n in a]))

shellsort([int(input()) for _ in range(int(input()))])

### FIXED CODE ###

def shellsort(a):
    l = len(a)
    gaps = [1]
    while gaps[0]*3+1 < (l/9 if l>100 else l) and len(gaps) <= 100:
        gaps.insert(0, gaps[0]*3+1)
    count = 0
    for g in gaps:
        for i in range(g, l):
            v = a[i]
            j = i-g
            while j >= 0 and v < a[j]:
                a[j+g] = a[j]
                j -= g
                count += 1
            a[j+g] = v

    print(len(gaps))
    print(" ".join([str(n) for n in gaps]))
    print(count)
    print("\n".join([str(n) for n in a]))

shellsort([int(input()) for _ in [None]*(int(input()))])
### BUGGY CODE ###

k = int(input())
from fractions import gcd
from functools import reduce

x = 0
for a in range(1, k+1):
  for b in range(1, k+1):
    for c in range(1, k+1):
      x += reduce(gcd, [a,b,c])
      
print(x)

### FIXED CODE ###

k = int(input())
from fractions import gcd
from functools import reduce

x = 3*k*k - 3*k +1
for a in range(2, k+1):
  for b in range(a, k+1):
    if gcd(a,b)==1:
      x += 6*(k-b)+3
    else:
      for c in range(b, k+1):
        if len({a, b, c})==1:
          x += reduce(gcd, [a,b,c])
        elif len({a, b, c})==2:
          x += 3*reduce(gcd, [a,b,c])
        else:
          x += 6*reduce(gcd, [a,b,c])
      
print(x)
### BUGGY CODE ###

T = int(input())
ABCD = [list(map(int,input().split())) for _ in range(T)]

for a,b,c,d in ABCD:
    if a < b:
        print('No')
        continue
    if d < b:
        print('No')
        continue
    tmp = a % b
    if tmp > c:
        print('No')
        continue
    if d % b == 0:
        print('Yes')
        continue
    if c >= b:
        print('Yes')
        continue

    if b - c == 1:
        print('Yes')
        continue
    
    dp = [a]
    now = a
    for _ in range(c+2):
        if now < b:
            print('No')
            break
        now %= b
        if now in dp:
            print('Yes')
            break
        if now > c:
            print('No')
            break
        dp.append(now)
        now += d

### FIXED CODE ###

#from math import gcd
from fractions import gcd
T = int(input())
ABCD = [list(map(int,input().split())) for _ in range(T)]

for a,b,c,d in ABCD:
    if a < b:
        print('No')
        continue
    if d < b:
        print('No')
        continue
    tmp = a % b
    if tmp > c:
        print('No')
        continue
    if d % b == 0:
        print('Yes')
        continue
    if c >= b-1:
        print('Yes')
        continue
    if a%2 == 0 and b%2 == 0 and d %2 == 0 and b-c == 2:
        print('Yes')
        continue
    GCD = gcd(b,d)
    if b-GCD +(a%GCD) > c:
        print('No')
    else:
        print('Yes')
### BUGGY CODE ###

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

a.sort()

for i in range(M):
    b = bc[i][0]
    c = bc[i][1]
    a.extend([c for i in range(b)])

a.sort(reverse=True)
print(sum(a[:N]))

### FIXED CODE ###

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

a.sort()
bc.sort(key=lambda x:x[1],reverse=True)

cnt = 0
for i in range(M):
    b = bc[i][0]
    c = bc[i][1]
    a.extend([c for i in range(b)])
    cnt += b
    if cnt > N:
        break

a.sort(reverse=True)
print(sum(a[:N]))
### BUGGY CODE ###

N, K = map(int, input().strip().split(" "))
scores = input().strip().split(" ")
i = 0
grade = 1
for i in range(K):
    grade *= int(scores[i])

for i in range(K, N):
    last = grade
    grade = int(grade / int(scores[i-K]))
    grade *= int(scores[i])
    if (grade > last):
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

N, K = map(int, input().strip().split(" "))
scores = input().strip().split(" ")

for i in range(K, N):
    if (int(scores[i]) > int(scores[i-K])):
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

#!/usr/bin/env pypy3

import collections
import math


def solve(n, xs):
    divisors = collections.Counter()
    for x in xs:
        for y in range(1, math.floor(math.sqrt(x)) + 1):
            d, m = divmod(x, y)
            if m == 0:
                divisors[y] += 1
                if y != d:
                    divisors[d] += 1
    for i in range(1, max(xs) + 1)[::-1]:
        if divisors[i] >= n - 1:
            return i


def main():
    n = int(input())
    xs = [int(x) for x in input().split()]
    print(solve(n, xs))


if __name__ == "__main__":
    main()

### FIXED CODE ###

#!/usr/bin/env python3

import itertools
try:
    from math import gcd
except ImportError:
    from fractions import gcd


class Cumulative(object):

    def __init__(self, seq, op):
        self.cumul_array = [0]
        self.cumul_array.extend(itertools.accumulate(seq, op))


def solve(n, xs):
    left_cumul = Cumulative(xs, gcd)
    right_cumul = Cumulative(reversed(xs), gcd)
    res = 1
    for i in range(n):
        left_gcd = left_cumul.cumul_array[i]
        right_gcd = right_cumul.cumul_array[n - i - 1]
        cand = gcd(left_gcd, right_gcd)
        if cand > res:
            res = cand
    return res


def main():
    n = int(input())
    xs = [int(x) for x in input().split()]
    res = solve(n, xs)
    print(res)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

A,B,K=map(int,input().split())
for i in range(K):
    if A>0:
        A-=1
    elif B>0:
        B-=1
print(A,B)

### FIXED CODE ###

A,B,K=map(int,input().split())
if A>=K:
    A=A-K
elif A+B>=K:
    B=B+A-K
    A=0
else:
    A=0
    B=0
print(A,B)
### BUGGY CODE ###

def main():
    import sys #追加
    sys.setrecursionlimit(500*500) #追加
    n = int(input())

    x = []
    l = []
    tls = []
    for i in range(n):
        tmp = list(map(int, input().split()))
        x.append(tmp[0])
        l.append(tmp[1])
    x, l = zip(*sorted(zip(x, l)))

    m = {}
    def solve(prev, idx):
        if idx == n:
            return 0
        key = (prev, idx)
        if key in m:
            return m[key]
        res_use = 0
        res_nouse = 0

        if x[idx] - l[idx] >= prev or prev == 0:
            res_use = 1
            res_use += solve(x[idx] + l[idx], idx + 1)
        res_nouse += solve(prev, idx + 1)

        ans = max(res_use, res_nouse)
        m[key] = ans
        return ans
    print(solve(0, 0))

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    x = []
    l = []
    for i in range(n):
        tmp = list(map(int, input().split()))
        x.append(tmp[0] - tmp[1])
        l.append(tmp[0] + tmp[1])
    x, l = zip(*sorted(zip(x, l)))
    maxcount = 0
    preve = 0
    idx = 0
    while idx < n:
        tmps = x[idx]
        tmpe = l[idx]
        if preve == 0:
            maxcount += 1
            preve = tmpe
        elif tmps >= preve:
            maxcount += 1
            preve = tmpe
        elif tmpe < preve:
            preve = tmpe
        idx += 1
    print(maxcount)
    return

if __name__ == "__main__":
    main()
### BUGGY CODE ###

N,M = map(int,input().split())
K = [[0, 0] for i in range(M)]
for i in range(M) :
    a,b = map(int,input().split())
    cx = tuple(map(int,input().split()))
    s = 0
    for c in cx :
        s = s | (1 << (c-1))
    K[i] = [s, a]

INF = 10**12
dp = [INF]*(1 << N)
dp[0] = 0

for bit in range(1 << N) :
    for i in range(M) :
        s,a = K[i]
        t = bit | s
        cost = dp[bit] + a
        dp[t] = min(dp[t], cost)

ans = dp[-1] if dp[-1] != INF else -1

print(ans)


### FIXED CODE ###

#Thanks, snuke!

N,M = map(int,input().split())
key = []
for i in range(M) :
    a,b = map(int,input().split())
    s = 0
    cx = list(map(int,input().split()))
    for j in range(b) :
        s = s | (1 << (cx[j]-1))
    key.append([s,a])

dp = [10**12 for i in range(1 << N)]
dp[0] = 0
for s in range(1 << N) :
    for i in range(M) :
        t = s | key[i][0]
        cost = dp[s] + key[i][1]
        dp[t] = min(dp[t], cost)

ans = dp[-1] if dp[-1] != 10**12 else -1

print(ans)
### BUGGY CODE ###

import sys
N, K = map(int,input().split())
Alist = list(map(int,input().split()))
Flist = list(map(int,input().split()))
Alist.sort()
sum_Alist = 0
for i in range(N):
    sum_Alist += Alist[i]
print(Alist,Flist,file=sys.stderr)
if sum_Alist <= K:
    print(0)
    exit()
maxtime = max(Alist)*max(Flist)
mintime = -1
print(maxtime,mintime,file=sys.stderr)
while mintime+1 < maxtime:
    mid = (mintime+maxtime)//2
    sum_midlist = 0
    max_midlist = 0
    midlist = [0 for i in range(N)]
    for i in range(N):
        midlist[i] = mid//Flist[i]
    midlist.sort()
    for i in range(N):
        if midlist[i] < Alist[i]:
            sum_midlist += Alist[i]-midlist[i]
    #print(maxtime,mintime,sum_midlist,file=sys.stderr)
    if sum_midlist <= K:
        maxtime = mid
    else:
        mintime = mid
print(maxtime)

### FIXED CODE ###

import sys
N, K = map(int,input().split())
Alist = list(map(int,input().split()))
Flist = list(map(int,input().split()))
Alist.sort()
sum_Alist = 0
for i in range(N):
    sum_Alist += Alist[i]
print(Alist,Flist,file=sys.stderr)
if sum_Alist <= K:
    print(0)
    exit()
maxtime = max(Alist)*max(Flist)
mintime = -1
print(maxtime,mintime,file=sys.stderr)
midlist = [0 for i in range(N)]
while mintime+1 < maxtime:
    mid = (mintime+maxtime)//2
    sum_midlist = 0
    max_midlist = 0
    for i in range(N):
        midlist[i] = mid//Flist[i]
    midlist.sort()
    for i in range(N):
        if midlist[i] < Alist[i]:
            sum_midlist += Alist[i]-midlist[i]
    #print(maxtime,mintime,sum_midlist,file=sys.stderr)
    if sum_midlist <= K:
        maxtime = mid
    else:
        mintime = mid
print(maxtime)
### BUGGY CODE ###

S = len(input())
cnt = "x"
length = 0
a = "x"
while S != length:
    cnt = cnt + a
    length = len(cnt)
print(cnt)

### FIXED CODE ###

S = len(input())
cnt = ""
length = 0
a = "x"
for i in range(S):
    cnt = cnt + a
print(cnt)
### BUGGY CODE ###

from collections import defaultdict
import itertools
import functools
import operator

def main():
    num = int(input())
    data = list(input())

    count_dic = defaultdict(int)

    for i in range(num):
        count_dic[data[i]] += 1

    count_list = list(count_dic.values())

    ans = 0
    for i in range(1, len(count_list) + 1):
        now_data = list(itertools.combinations(count_list, i))
        for ele in now_data:
            result = functools.reduce(operator.mul, ele)
            ans += result
    mod = 10 ** 9 + 7
    print(ans % mod)





if __name__ == '__main__':
    main()


### FIXED CODE ###


from collections import defaultdict

def main():
    num = int(input())
    data = list(input())

    count_dic = defaultdict(int)

    for i in range(num):
        count_dic[data[i]] += 1

    count_list = list(count_dic.values())

    ans = 1
    for ele in count_list:
        ans *= ele + 1

    mod = 10 ** 9 + 7
    print((ans - 1) % mod)





if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = input()
n = input()
nl = list(n)
ans = 1000000
for i in range(len(n)+1):
    test = []
    temp = 0
    for c in range(i):
        test.append("E")
    for c in range(len(n)-i):
        test.append("W")
    for j in range(len(n)):
        if nl[j] != test[j]:
            temp += 1
    if ans > temp:
        ans = temp
    # print(nl,test,temp)
print(ans)

### FIXED CODE ###

n = input()
n = input()
nl = list(n)
w = [0 for i in range(len(n))]
e = [0 for i in range(len(n))]
w[0] = 1 if nl[0] == "W" else 0
e[0] = 1 if nl[0] == "E" else 0
for i in range(len(n)-1):
    w[i+1] = w[i] + 1 if nl[i+1] == "W" else w[i]
    e[i+1] = e[i] + 1 if nl[i+1] == "E" else e[i]
wr = [0 for i in range(len(n))]
er = [0 for i in range(len(n))]
ans = [0 for i in range(len(n))]
for i in range(len(n)):
    wr[i] = w[len(n)-1] - w[i]
    er[i] = e[len(n)-1] - e[i]
for i in range(len(n)):
    temp = w[i] - 1 if nl[i] == "W" else w[i]
    ans[i] = temp + er[i]
# print(w)
# print(e)
# print(wr)
# print(er)
# print(ans)
print(min(ans))
### BUGGY CODE ###

ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
def is_primes(n):
    primes = [1]*n
    primes[0] =0
    primes[1] =0
    for i in range(2,int(n**0.5)+1):
        if primes[i] ==1:
            for j in range(2*i,n,i):
                primes[j] = 0
    return primes

def factorize(n,prms):
    b = 2
    fct = []
    while b * b <= n:
        if not prms[b]:
            continue
        cnt =0
        while n % b == 0:
            n //= b
            cnt +=1
        if cnt >=1:
            fct.append((b,cnt))
        b = b + 1
    if n > 1:
        fct.append((n,1))
    return fct

n =ni()
A = lma()
mx= 2*10**6
prms = is_primes(mx+1)
d=collections.Counter()
for a in A:
    fct = factorize(a,prms)
    #print(fct)
    for fc,cnt in fct:
        d[fc]+=1
        if d[fc]==n:
            break
f1=True # pp or sp
f2=True # sp or other
for num,cnt in d.items():
    if cnt==n:
        f2=False #other
        break
    else:
        if cnt==1:
            pass
        else:
            f1=False
            break
if f2==False:
    print("not coprime")
elif f1 and f2:
    print("pairwise coprime")
elif f1==False:
    print("setwise coprime")


### FIXED CODE ###

ma = lambda :map(int,input().split())
lma = lambda :list(map(int,input().split()))
tma = lambda :tuple(map(int,input().split()))
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
gcd=math.gcd

def is_primes(n):
    primes = [1]*n
    primes[0] =0
    primes[1] =0
    for i in range(2,int(n**0.5)+2):
        if primes[i] ==1:
            for j in range(2*i,n,i):
                primes[j] = 0
    return primes
def factorize(n,primes):
    fct = [(1,1)]
    for b in primes:#primes ::sorted
        if b**2 > n:
            break
        cnt =0
        while n % b == 0:
            n //= b
            cnt +=1
        if cnt >=1:
            fct.append((b,cnt))
    if n > 1:
        fct.append((n,1))
    return fct

n =ni()
A = lma()
mx= 10**6+10
prms = is_primes(mx)
prms2=[i for i in range(mx) if prms[i]]
#print(prms2)
d=collections.Counter()
for a in A:
    fct = factorize(a,prms2)
    #print(fct)
    for fc,cnt in fct:
        if fc==1:continue
        d[fc]+=1

f1=True # pp or sp
f2=True # sp or not p
for num,cnt in d.items():
    if cnt==n:
        f2=False #numが全体で共通の約数になる not coprime
        break
    else:
        if cnt==1:## 素
            pass
        else:
            f1=False

if f2==False:
    print("not coprime")
elif f1:
    print("pairwise coprime")
else:
    print("setwise coprime")
### BUGGY CODE ###

N=int(input())
l=list()
for i in range(N):
    l.append(int(input()))

num=list()
M=max(l)
for k in range(N):
    if(l[k]==M):
        num=l[:k]+l[k+1:]
        print(max(num))
    else:
        print(M)


### FIXED CODE ###

N=int(input())
l=list()
for i in range(N):
    l.append(int(input()))
a=sorted(l)
m1=a[-1]
m2=a[-2]
for k in range(N):
    if(m1==l[k]):
        print(m2)
    else:
        print(m1)
### BUGGY CODE ###

def main():
  n,*d=map(int,open(0).read().split())
  e=[0]*n
  for i in d:e[i]+=1
  a=1if d[0]<1else 0
  for i in d[1:]:a*=e[i-1]
  print(a%998244353)
main()

### FIXED CODE ###

_,d=open(0)
*d,=map(int,d.split())
e=[0]*-~max(d)
for i in d:e[i]+=1
a=d[0]<1==e[0]
for x,y in zip(e,e[1:]):a*=x**y
print(a%998244353)