"""input""" #int-input # input = sys.stdin.readline def II(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(MI()) #str-input def SI(): return input() def MSI(): return input().split() def SI_L(): return list(SI()) def SI_LI(): return list(map(int, SI())) #multiple-input def LLI(n): return [LI() for _ in range(n)] def LSI(n): return [SI() for _ in range(n)] #1-indexを0-indexでinput def MI_1(): return map(lambda x:int(x)-1, input().split()) def TI_1(): return tuple(MI_1()) def LI_1(): return list(MI_1()) from collections import deque,defaultdict,Counter mod = 998244353 class fenwick_tree(): n=1 data=[0 for i in range(n)] def __init__(self,N): self.n=N self.data=[0 for i in range(N)] def add(self,p,x): assert 0<=p0): s+=self.data[r-1] r-=r&-r return s #必ず入っている集合を見つける #必ず以下マン、以上マンを見つける # 上72回まで # その後は8回 def doubling(nex:list, k:int = 1<<60 ,a:list = None) -> list: """nex:操作列 k:回数 a:初期列""" n = len(nex) #繰り返し回数の取得 log = (k+1).bit_length() res = [nex[:]] #ダブリング配列 #1,2,4,8...と入る p = [1,-1] for cnt in range(1,log): res.append([0]*n) for i in range(n): res[cnt][i] = res[cnt-1][i] + p[i%2] * res[cnt-1][res[cnt-1][i]] # 遷移先ではなく移動回数を保存しておくveri # res[cnt][i] = res[cnt-1][(res[cnt-1][i]+i)%n] + res[cnt-1][i] if k == 1<<60: return res #0回目の遷移(つまり初期状態) ans = ([*range(n)] if a is None else a[:]) for cnt in range(log): if k & (1<