Harryxun/stf_run huggingface dataset:
import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N = int(input())
e = dd(list)
for _ in range(N - 1):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)

cl = [0] * (N + 1)
vis = set()
def dfs(x):
  global cl
  global vis
  vis.add(x)
  for y in e[x]:
    if y in vis: continue
    cl[y] = (cl[x] + 1) % 2

dfs(1)
bl = cl.count(1)
wh = N - bl
res = [0] * (N + 1)
nm = [[] for _ in range(3)]
for i in range(1, N + 1): nm[i % 3].append(i)
#print(cl)
if bl <= N // 3:
  for i in range(1, N + 1):
    if cl[i]:
      res[i] = nm[0].pop()
    else:
      if len(nm[1]): res[i] = nm[1].pop()
      else: res[i] = nm[2].pop()
  print(*res[1: ])
  exit(0)
if wh <= N // 3:
  for i in range(1, N + 1):
    if cl[i] == 0:
      res[i] = nm[0].pop()
    else:
      if len(nm[1]): res[i] = nm[1].pop()
      else: res[i] = nm[2].pop()
  print(*res[1: ])
  exit(0)
#print(nm)
#print(cl, nm)
f = 0
for i in range(1, N + 1):
  if cl[i]:
    if len(nm[1]):
      res[i] = nm[1].pop()
    else:
      if len(nm[0]):
        res[i] = nm[0].pop()
      else:
        f = 1
        break
  else:
    if len(nm[2]):
      res[i] = nm[2].pop()
    else:
      if len(nm[0]):
        res[i] = nm[0].pop()
      else:
        f = 1
        break
if f:
  nm = [[] for _ in range(3)]
  for i in range(1, N + 1): nm[i % 3].append(i)
  res = [0] * (N + 1)
  for i in range(1, N + 1):
    if cl[i] == 0:
      if len(nm[1]):
        res[i] = nm[1].pop()
      else:
        if len(nm[0]):
          res[i] = nm[0].pop()
        else:
          print(-1)
          exit(0)
    else:
      if len(nm[2]):
        res[i] = nm[2].pop()
      else:
        if len(nm[0]):
          res[i] = nm[0].pop()
        else:
          print(-1)
          exit(0)
print(*res[1: ])

### FIXED CODE ###

import sys
from collections import defaultdict as dd
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N = int(input())
e = dd(list)
for _ in range(N - 1):
  u, v = map(int, input().split())
  e[u].append(v)
  e[v].append(u)

cl = [0] * (N + 1)
vis = set()
def dfs(x):
  global cl
  global vis
  vis.add(x)
  for y in e[x]:
    if y in vis: continue
    cl[y] = (cl[x] + 1) % 2
    dfs(y)

dfs(1)
bl = cl.count(1)
wh = N - bl
res = [0] * (N + 1)
nm = [[] for _ in range(3)]
for i in range(1, N + 1): nm[i % 3].append(i)
#print(cl)
if bl <= N // 3:
  for i in range(1, N + 1):
    if cl[i]:
      res[i] = nm[0].pop()
    else:
      if len(nm[1]): res[i] = nm[1].pop()
      elif len(nm[2]): res[i] = nm[2].pop()
      else: res[i] = nm[0].pop()
  print(*res[1: ])
  exit(0)
if wh <= N // 3:
  for i in range(1, N + 1):
    if cl[i] == 0:
      res[i] = nm[0].pop()
    else:
      if len(nm[1]): res[i] = nm[1].pop()
      elif len(nm[2]): res[i] = nm[2].pop()
      else: res[i] = nm[0].pop()
  print(*res[1: ])
  exit(0)
#print(nm)
#print(cl, nm)
f = 0
for i in range(1, N + 1):
  if cl[i]:
    if len(nm[1]):
      res[i] = nm[1].pop()
    else:
      res[i] = nm[0].pop()
  else:
    if len(nm[2]):
      res[i] = nm[2].pop()
    else:
      res[i] = nm[0].pop()

print(*res[1: ])
import math
r = int(input())
print(r*r*math.pi, 2*r*math.pi)

### FIXED CODE ###

import math
r = float(input())
print(r**2*math.pi, r*2*math.pi)
from sys import stdin
N = int(stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
X = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for i in x:
    if i < K - i:
        ans += 2 * i
    else:
        ans += 2 * (K - i)
print(route)

### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
K = int(stdin.readline().rstrip())
X = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for i in X:
    if i < K - i:
        ans += 2 * i
    else:
        ans += 2 * (K - i)
print(ans)
a, b, c = map(str, input().split())
a = int(a)
b = int(b)
print(a + b if op == "+" else a - b)

### FIXED CODE ###

a, op, b = map(str, input().split())
a = int(a)
b = int(b)
print(a + b if op == "+" else a - b)
import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
t = [int(input()) for i in range(n)]

result = lcm_list(t)
print(result)

### FIXED CODE ###

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

def lcm_base(x, y):
	return (x * y) // gcd(x, y)

def lcm_list(numbers):
    ans = lcm_base(numbers[0], numbers[1])
    for x in numbers:
        ans = lcm_base(ans, x)
    return ans

n = int(input())
t = [int(input()) for i in range(n)]

result = lcm_list(t) if len(t) != 1 else t[0]
print(result)
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in range(1,N):
  l[A[i-1]-1] += 1
for i in range(N):
  print(l[i])

### FIXED CODE ###

r = int(input())
print(6.3*r)
S = input()

if S == 'AAA' or S = 'BBB':
  print('No')
else:
  print('Yes')

### FIXED CODE ###

S = input()
 
if S == 'AAA' or S == 'BBB':
  print('No')
else:
  print('Yes')
s = input()
print(700　+ int(s.count("o"))*100)

### FIXED CODE ###

s=input()
print(700+int(s.count("o"))*100)
GNU nano 2.9.3                                                                                       a.py                                                                                                 

class Dice():
        def __init__(self,data):
                self.number = data

        def rota_S(self):
                self.number[0],self.number[1],self.number[5],self.number[4] = self.number[1],self.number[5],self.number[4],self.number[0]
        def rota_E(self):
                self.number[0],self.number[2],self.number[5],self.number[3] = self.number[2],self.number[5],self.number[3],self.number[0]
        def rota_W(self):
                self.number[0],self.number[3],self.number[5],self.number[2] = self.number[3],self.number[5],self.number[2],self.number[0]
        def rota_N(self):
                self.number[0],self.number[4],self.number[5],self.number[1] = self.number[4],self.number[5],self.number[1],self.number[0]

        def get_top(self):
                return self.number[0]
data = list(map(int,input().split()))
opt = input()

mydice = Dice(data)
print(mydice.number)
for c in range(len(opt)):
        print(opt[c])
        if(opt[c] == "S"):      mydice.rota_S()
        elif(opt[c] == "E"):    mydice.rota_E()
        elif(opt[c] == "W"):     mydice.rota_W()
        elif(opt[c] == "N"):     mydice.rota_N()
        else: print("something error")
print(mydice.get_top())




### FIXED CODE ###

class dice:
    def __init__(self, pip):
        self.pip = pip
        
    def move(self,dir):
        if str(dir) == "E":
            self.pip[0],self.pip[2],self.pip[3],self.pip[5] = self.pip[3],self.pip[0],self.pip[5],self.pip[2]
        elif str(dir) == "W":
            self.pip[0],self.pip[2],self.pip[3],self.pip[5] = self.pip[2],self.pip[5],self.pip[0],self.pip[3]
        elif str(dir) == "N":
            self.pip[0],self.pip[1],self.pip[4],self.pip[5] = self.pip[1],self.pip[5],self.pip[0],self.pip[4]
        elif str(dir) == "S":
            self.pip[0],self.pip[1],self.pip[4],self.pip[5] = self.pip[4],self.pip[0],self.pip[5],self.pip[1]

d = dice(list(map(int,input().split())))
inp = list(input())

for dir in inp:
    d.move(dir)

print(d.pip[0])
n, m, k = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
A.append(0)
B.append(0)
time = 0
cnt = 0
a, b = 0, 0
while (a < m and time + A[a] <= k) or (b < n and time + B[b] <= k):
    if (a < m and time + A[a] <= k) and (b < n and time + B[b] <= k):
        if A[a] <= B[b]:
            cnt += 1
            time += A[a]
            a += 1
        else:
            cnt += 1
            time += B[b]
            b += 1
    elif (a < m and time + A[a] <= k):
        cnt += 1
        time += A[a]
        a += 1
    else:
        cnt += 1
        time += B[b]
        b += 1
print(cnt)


### FIXED CODE ###

n, m, k = map(int, input().split())
*A, = map(int, input().split())
*B, = map(int, input().split())
SA, SB = [0], [0]
for i in range(n):
    SA.append(SA[i] + A[i])
for j in range(m):
    SB.append(SB[j] + B[j])
ans, tmp = 0, m
for i in range(n + 1):
    if SA[i] > k:
        break
    for j in range(tmp + 1)[::-1]:
        if SA[i] + SB[j] <= k:
            break
    ans = max(ans, i + j)
    tmp = j
print(ans)
from scipy.special import comb
N = int(input())
A = sorted(list(map(int, input().split())), reverse = True)

if N == 2:
	print(A[0], A[1])
else:
	q = max(A)
	B = list(map(lambda x : abs(q // 2 - x),  A))
	print(q, A[B.index(min(B))])

### FIXED CODE ###

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

if N == 2:
	print(A[0], A[1])
else:
	q = max(A)
	B = list(map(lambda x : abs(q // 2 - x),  A))
	print(q, A[B.index(min(B))])
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
def dfs(start,stop):
    visited[start] = True
    if start == stop:
        return
    else:
        for term in edges[start]:
            if visited[term]: continue
            dfs(term,stop)
dfs(0,N-1)
import copy 
fromFennec = copy.deepcopy(visited)
visited = [False for _ in range(N)]
fennec = common = snuke = 0
for i in range(1,N-1):
    if fromFennec[i] and visited[i]:
        common += 1
    else:
        if fromFennec[i]:
            fennec += 1
        else:
            snuke += 1
F = fennec + common//2 + common%2
S = snuke + common//2
if F > S:
    print("Fennec")
else:
    print("Snuke")

            


### FIXED CODE ###

import sys
sys.setrecursionlimit(2*10**5)
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
fennec = [-1 for _ in range(N)]
snuke = [-1 for _ in range(N)]
def dfs(start,visited,distance,d):
    visited[start] = True
    d[start] = distance
    for term in edges[start]:
        if visited[term]:
            continue
        dfs(term,visited,distance + 1,d)
dfs(0,visited,0,fennec)

visited = [False for _ in range(N)]
    
dfs(N-1,visited,0,snuke)
F = S = 0
for i in range(N):
    if fennec[i] <= snuke[i]:
        F+=1
    else:
        S+=1
if F>S:
    print("Fennec")
else:
    print("Snuke")
# -*- coding:utf8 -*-

n = int(input())
s = [input() for _ in range(n)]
s = [''.join(sorted(i)) for i in s]
c = collections.Counter(s)
t = [list(range(i)) for i in list(c.values()) if i != 1]
a = [sum(i) for i in t]
print(sum(t))

### FIXED CODE ###

# -*- coding:utf8 -*-
import collections

n = int(input())
s = [input() for _ in range(n)]
s = [''.join(sorted(i)) for i in s]
c = collections.Counter(s)
t = [range(i) for i in list(c.values()) if i != 1]
a = [sum(i) for i in t]
print(sum(a))
N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
  if ls[x] == False:
    ls_mod.append(x)
    ls[x] = m
    x = (x**2)%M
  else:
    last = m
    fast = ls[x]
    diff = last - fast
    break
if last >= N:
  print(sum(ls_mod[:N]))
"""else:
  shou = (N-fast) // diff
  amari = (N-fast) % diff
  print(sum(ls_mod[:fast])+sum(ls_mod[fast:])*shou+sum(ls_mod[fast:fast+amari]))
"""


### FIXED CODE ###

N, X, M = map(int, input().split())
ls = [False]*M
ls_mod = []
x = X
for m in range(M+1):
  if ls[x] == False:
    ls_mod.append(x)
    ls[x] = m
    x = (x**2)%M
  else:
    last = m
    fast = ls[x]
    diff = last - fast
    break
if M == 1:
  print(0)
else:
  if last > N:
    print(sum(ls_mod[:N]))
  else:
    shou = (N-fast) // diff
    amari = (N-fast) % diff
    print(sum(ls_mod[:fast])+sum(ls_mod[fast:])*shou+sum(ls_mod[fast:fast+amari]))
import math
N, K = input().split()
N = int(N)
K = int(K)
def P(n, r):
  return math.factorial(n)//math.factorial(n-r)
def C(n, r):
  return P(n, r)//math.factorial(r)
for i in range(K):
  ans= C(K-1,i)*C(N-K+1,i+1)
  print(ans%(10**9+7))

### FIXED CODE ###

import math
N, K = input().split()
N = int(N)
K = int(K)
def P(n, r):
  return math.factorial(n)//math.factorial(n-r)
def C(n, r):
  return P(n, r)//math.factorial(r)
for i in range(1,K+1):
  if N-K+1<i:
    print(0)
  else:
  	ans= (C(K-1,i-1)*C(N-K+1,i))%(10**9+7)
  	print(ans)
price, len_hate_set = map(int, input().split())
hate_set = set([int(i) for i in input().split()])

ans = 0

while True:
    if all(map(lambda x: int(x) in set(range(0, 10)) - hate_set, [int(str(ans)[i]) for i in range(len(str(ans)))])) and ans >= price:
        return ans
    ans += 1


### FIXED CODE ###

def abc042_c():
    price, len_hate_set = map(int, input().split())
    hate_set = set([int(i) for i in input().split()])

    usable_list = list(set(range(0, 10)) - hate_set)

    ans = 0

    while True:
        if all(map(lambda x: int(x) in usable_list, [int(str(ans)[i]) for i in range(len(str(ans)))])) and ans >= price:
            return ans

        ans += 1


if __name__ == '__main__':
    print(abc042_c())
import math
r =  int(input())
print("{0:.5f}".format(r*r*math.pi))
print("{0:.5f}".format(2*r*math.pi))



### FIXED CODE ###

import math
r = float(input())
print("{0:.5f}".format(r*r*math.pi))
print("{0:.5f}".format(2*r*math.pi))
s = inptu()
s = list(s)
s_cut = s[0::2]
ans = ""
for i in s_cut:
    ans += i
print(ans)  

### FIXED CODE ###

s = input()
s = list(s)
s_cut = s[0::2]
ans = ""
for i in s_cut:
    ans += i
print(ans)
bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)]

n = int(input())
for i in range(n)
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

i = 0
j = 0
k = 0
while i < 4:
    while j < 3:
        floar = ""
        while k < 10:
            floar += str(bilding[i][j][k])
            k += 1
        print floar
        j += 1
    if i < 3:
        print "####################"
    i += 1

### FIXED CODE ###

bilding = [[[0 for x in range(10)] for x in range(3)]for x in range(4)] 
n = int(input())
for k in range(n):
    b, f, r, v = map(int, raw_input().split())
    bilding[b-1][f-1][r-1] += v

for b in range(4):
    for f in range(3):
        print(" "+" ".join(map(str, bilding[b][f])))
    if b != 3:
        print("#"*20)
N = int(input())
series = list(map(int,input().split()))


series_sorted = series[:]
series_sorted.sort()

def make_no_decrease(condition, series):
    if condition == 0:#正の整数列
        for i in range(1,N):
            print(i, i+1)
    elif condition == 1:#負の整数列
        for i in range(1,N):
            print(N-i+1, N-i)
            
if series_sorted[0]  >= 0: #正の時
    print(len(series)-1)
    make_no_decrease(0, series)
elif series_sorted[-1] < 0: #負の時
    print(len(series)-1)
    make_no_decrease(1, series)
else:
    if abs(series_sorted[-1]) <= abs(series_sorted[0]): #負の値のほうが大きい時
        print(2*len(series)-1)
        min = series.index(series_sorted[0])
        for i in range(len(series)):
            print(min+1, i)
        make_no_decrease(1, series)
    else abs(series_sorted[0]) < abs(series_sorted[-1]): #正の値のほうが大きい時
        print(2*len(series)-1)
        max = series.index(series_sorted[-1])
        for i in range(len(series)):
            print(max+1, i+1)
        make_no_decrease(0, series)

### FIXED CODE ###

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


series_sorted = series[:]
series_sorted.sort()

def make_no_decrease(condition, series):
    if condition == 0:#正の整数列
        for i in range(1,N):
            print(i, i+1)
    elif condition == 1:#負の整数列
        for i in range(1,N):
            print(N-i+1, N-i)
            
if series_sorted[0]  >= 0: #正の時
    print(len(series)-1)
    make_no_decrease(0, series)
elif series_sorted[-1] < 0: #負の時
    print(len(series)-1)
    make_no_decrease(1, series)
else:
    if abs(series_sorted[-1]) <= abs(series_sorted[0]): #負の値のほうが大きい時
        print(2*len(series)-1)
        min = series.index(series_sorted[0])
        for i in range(len(series)):
            print(min+1, i+1)
        make_no_decrease(1, series)
    elif abs(series_sorted[0]) < abs(series_sorted[-1]): #正の値のほうが大きい時
        print(2*len(series)-1)
        max = series.index(series_sorted[-1])
        for i in range(len(series)):
            print(max+1, i+1)
        make_no_decrease(0, series)
H, N = map(int, input().split())
A_list = []
for i in range(1, N+1):
    A_list.append("A_" + str(i))

A_list = int(input())
A_total = sum(A_list)

if A_total >= H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

H, N = map(int, input().split())
A_list = []
for i in range(1, N+1):
    A_list.append("A_" + str(i))

A_list = map(int, input().split())
A_total = sum(A_list)

if A_total >= H:
    print("Yes")
else:
    print("No")
#!/usr/bin/env python3
import sys
from itertools import accumulate
INF = float("inf")


def solve(N: int, C: int, s: "List[int]", t: "List[int]", c: "List[int]"):
    # いもす法
    seq = [0]*(10**5+1)
    for sv, tv, cv in zip(s, t, c):
        seq[sv] += 1
        seq[tv+1] -= 1
    acc = list(accumulate(seq))
    # print(seq)
    # print(acc)
    print(max(acc))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [int()] * (N)  # type: "List[int]"
    t = [int()] * (N)  # type: "List[int]"
    c = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        s[i] = int(next(tokens))
        t[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, C, s, t, c)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from itertools import accumulate
INF = float("inf")


def solve(N: int, C: int, s: "List[int]", t: "List[int]", c: "List[int]"):
    seq = [0]*(3*10**5)
    # チャンネルを切り替えない場合、0.5秒のラグが発生しない。
    # 同じチャンネルでしりとあたまがいっしょなら、ひとつの番組にしておく
    c, s, t = zip(*sorted(sorted(zip(c, s, t), key=lambda x: x[1])))
    # いもす法
    # seq = [0]*(40)
    pre_s, pre_t, pre_c = -1, -1, -1
    for sv, tv, cv in zip(s, t, c):
        if pre_c == cv and pre_t == sv:
            seq[2*pre_t] += 1
            seq[2*tv] -= 1
        else:
            seq[2*sv-1] += 1
            seq[2*tv] -= 1
        pre_s, pre_t, pre_c = sv, tv, cv
    acc = list(accumulate(seq))
    # print(seq)
    # print(acc)
    print(max(acc))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    s = [int()] * (N)  # type: "List[int]"
    t = [int()] * (N)  # type: "List[int]"
    c = [int()] * (N)  # type: "List[int]"
    for i in range(N):
        s[i] = int(next(tokens))
        t[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, C, s, t, c)


if __name__ == '__main__':
    main()
n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b	= map(int,input().split())

    if h[a-1] <	h[b-1]:
	nn[a-1]=0
    else:
	nn[b-1]=0

print(sum(nn))

### FIXED CODE ###

n,m = map(int,input().split())
h = [int(i) for i in input().split()]
nn = [1]*n
for _ in range(m):
    a,b = map(int,input().split())
    if h[a-1] ==h[b-1]:
        nn[a-1]=0
        nn[b-1]=0
    elif h[a-1] < h[b-1]:
        nn[a-1]=0
    else:
        nn[b-1]=0

print(sum(nn))
while True:
    n = int(input())
    if n == 0:
        break
    a = list(map(int, input().split()))
    l = []
    for i in range(1, n-1):
        for j in range(i+1,n):
            l.append(abs(a[i]-a[j]))
    print(min(l))



### FIXED CODE ###

while True:
    n = int(input())#人数の受け取り
    if n == 0:#０人or何も入力しないなら終了
        break
    a = list(map(int, input().split()))#各人の成績の受け取り
    l = list()#出力の受け取り用
    for i in range(0, n):#成績の比較
        for j in range(0, n):
            if i == j:
                continue
            l.append(abs(a[i]-a[j]))#絶対値を受け取り用のlistに入力
    else:#listが完成したら
        print(min(l))#成績の一番近い生徒の差を出力
s=input()

ans='No'
for i in range(len(s)):
    if s[i]=='C':
        temp=s[i:]
        break
for i in temp:
    if i=='F':
        ans='Yes'
        break
        
print(ans)

### FIXED CODE ###

s=input()

ans='No'
temp=''
for i in range(len(s)):
    if s[i]=='C':
        temp=s[i:]
        break
for i in temp:
    if i=='F':
        ans='Yes'
        break
        
print(ans)
s = input()
k = (int)(input())

c = 0
for c in s:
  if not c == '1':
    break
  c += 1
n = s[c] if c < len(S) else None
a = n if n and c < K else S[0]
print(a)


### FIXED CODE ###

s = input()
k = (int)(input())

c = 0
for ch in s:
  if not ch == '1':
    break
  c += 1
n = s[c] if c < len(s) else None
a = n if n and c < k else s[0]
print(a)
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g=list(''.join(g)*2)
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

### FIXED CODE ###

d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])
S = input()

    d = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
    print(d[S])

### FIXED CODE ###

S = input()

d = {"SUN": 7, "MON": 6, "TUE": 5, "WED": 4, "THU": 3, "FRI": 2, "SAT": 1}
print(d[S])
N = int(input())
S = input().split()
count = 0
for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        count += 1
print(count+1)

### FIXED CODE ###

N = int(input())
S = input()

checklist = []

for i in range(N-1):
    j = i+1
    if S[i] != S[j]:
        checklist.append(S[i])
print(len(checklist)+1)
from collections import deque

n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(n):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

visit = [0] * (n + 1)
q = deque([1])
while q:
    now = q.popleft()
    visit[now] = 1
    for i in graph[now]:
        if visit[i] == 0:
            q.append(i)

depth = sum(visit)
ans = 0
visit = [0] * (n + 1)


def dfs(now, count):
    global ans
    if count == depth:
        ans += 1
    else:
        for i in graph[now]:
            if visit[i] == 0:
                visit[now] = 1
                dfs(i, count + 1)
                visit[now] = 0


dfs(1, 1)
print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
graph = [[] for _ in range(n + 1)]
for _ in range(m):
    a, b = map(int, input().split())
    graph[a].append(b)
    graph[b].append(a)

visit = [0] * (n + 1)


def dfs(now, depth):
    if visit[now]:
        return 0
    if depth == n:
        return 1

    count = 0
    visit[now] = 1
    if graph[now]:
        for i in graph[now]:
            count += dfs(i, depth + 1)
    visit[now] = 0

    return count


ans = dfs(1, 1)
print(ans)