Harryxun/stf_run huggingface dataset:
def test(original: list, array: list, index: int,
         remain_count: int, results: set):
    # 3桁抽出したら終了
    if len(array) == 3:
        # print("".join(array))
        results.add("".join(array))
        return
    # 最終桁に到達したら終了
    if index == len(original):
        return
    # この桁を抽出対象とするパターン
    test(original, array[:], index + 1, remain_count - 1, results)

    # この桁を抽出対象としないパターン
    new_array = array[:]
    new_array.append(
        original[index])
    test(
        original,
        new_array,
        index + 1,
        remain_count,
        results)


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

results = set()

# N個の要素
# N-3個を削除
# 3個の組み合わせが何通りあるか？
test(S, [], 0, N - 3, results)

print(len(results))


### FIXED CODE ###

def test(original: list, nums: str, index: int,
         remain_count: int, results: set, results_1, results_2):
    # 3桁抽出したら終了
    if len(nums) == 1:
        if nums in results_1:
            return
        results_1.add(nums)
    if len(nums) == 2:
        if nums in results_2:
            return
        results_2.add(nums)
    if len(nums) == 3:
        # print("".join(array))
        results.add(nums)
        return
    # 最終桁に到達したら終了
    if index == len(original):
        return
    for i in range(index, len(original), 1):
        test(
            original,
            nums + original[i],
            i + 1,
            remain_count,
            results,
            results_1,
            results_2)

    # この桁を抽出対象としないパターン
    # test(original, array[:], index + 1, remain_count - 1, results)


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

results = set()
results_1 = set()
results_2 = set()

# N個の要素
# N-3個を削除
# 3個の組み合わせが何通りあるか？
test(S, "", 0, N - 3, results, results_1, results_2)

print(len(results))
from collections import deque

INF = float('inf')

H,W=map(int,input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

## '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for i in range(H):
    for j in range(W):
        if grid[i][j]=="#":
            dist[i][j]=0
            black_cells.append((i,j))

whileblack_cells:
    x,y=black_cells.popleft()#黒マスのスタート地点
    d=dist[x][y]#スタート地点からの距離
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        new_x=x+dx
        new_y=y+dy
        if new_y < 0 or H <= new_y or new_x < 0 or W <= new_x:#範囲からはみ出すとき
            continue
        elif dist[new_x][new_y]==-1:
            dist[new_x][new_y]=d+1
            black_cells.append((new_x,new_y))
print(d)


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
grid = [input() for i in range(H)]

# 初期の黒('#')の位置からの距離
dist = [[-1]*W for _ in range(H)]

# '#'の位置をキューに追加（＝今回はこれが複数あるので、複数スタートとなる）
black_cells = deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == '#':
            black_cells.append((h, w))
            dist[h][w] = 0

def bfs(black_cells, dist):
    """
    BFSを用いて、全マス目を黒くする回数を求める

    Args:
        black_cells: 「開始時の黒マス」の座標が入ったキュー（複数座標あり）
        dist: 「開始時の黒マス」からの距離の入ったリスト  [[-1, -1, 0], ...]
        　　　（白マスの初期値は0）

    Returns:
        g: 操作を繰り返した数
    """
    d = 0
    while black_cells:
        # キューとして使うのでpop()ではなくpopleft()
        h, w = black_cells.popleft()
        d = dist[h][w]
        for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
            new_h = h + dy
            new_w = w + dx
            if new_h < 0 or H <= new_h or new_w < 0 or W <= new_w:
                continue
            if dist[new_h][new_w] == -1:  # セルが白('.')であるのと同義
                dist[new_h][new_w] = d+1
                black_cells.append((new_h, new_w))
    return d

d = bfs(black_cells, dist)
print(d)
a = raw_input()
print (a * a * a)

### FIXED CODE ###

print(int(input())**3)
import fractions as gcd

a, b = map(int, input().split())
print(a*b // gcd(a,b))

### FIXED CODE ###

from fractions import gcd
a,b=map(int,input().split())
 
result=int(a*b//gcd(a,b))
print(result)
S_input = input()
    
S = S_input[::-1]
end_flg = 1
while end_flg:
    if S.startswith('maerd'):
        S = S.replace('maerd', '', 1)
    elif S.startswith('remaerd'):
        S = S.reaplace('remaerd','',1)
    elif S.startswith('esare'):
        S = S.replace('esare','',1)
    elif S.startswith('resare'):
        S = S.replace('resare', '', 1)
    else:
        end_flg = 0
if len(S) == 0:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

#C - Day dream
S_input = input()
S = S_input
for i in range(len(S_input)):
    S = S[:i]+S_input[len(S_input)-1-i]+S[i+1:]
#print(S)
#S_input = input()
    
#S = S_input[::-1]
end_flg = 1
while end_flg:
    if S.startswith('maerd'):
        S = S.replace('maerd', '', 1)
    elif S.startswith('remaerd'):
        S = S.replace('remaerd','',1)
    elif S.startswith('esare'):
        S = S.replace('esare','',1)
    elif S.startswith('resare'):
        S = S.replace('resare', '', 1)
    else:
        end_flg = 0
if len(S) == 0:
    print('YES')
else:
    print('NO')
N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(w)>=2:
        print('No')
        exit()

for x in range (1,N+1):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()
print("Yes")


### FIXED CODE ###

N=int(input())
Ws=[]
for n in range(N):
    W=input()
    Ws.append(W)

for w in range(len(Ws)):
    if Ws.count(Ws[w])>=2:
        print("No")
        exit()
        
for x in range (1,len(Ws)):
    if Ws[x][0] != Ws[x-1][-1]:
        print("No")
        exit()

print("Yes")
import numpy as np
h, w, n = map(int, input().split(" "))
board = np.zeros((h, w))
for i in range(n):
  a, b = map(int, input().split(" "))
  board[a - 1][b - 1] = 1
result = [0 for _ in range(10)]
for start_h in range(h - 2):
  for start_w in range(w - 2):
    sum_black = np.count_nonzero(board[start_h:(start_h+3), start_w:(start_w + 3)] > 0)
    result[sum_black] += 1

for one_result in result:
  print(one_result)

### FIXED CODE ###

import collections
h, w, n = map(int, input().split(" "))
list_include = []
for i in range(n):
  a, b = map(int, input().split(" "))
  for y in range(3):
    for x in range(3):
      if a - y > 0 and a - y + 2 <= h:
        if b - x > 0 and b - x + 2 <= w:
          list_include.append((a - y, b - x))
count = collections.Counter(list_include)
result = [0 for _ in range(10)]
for item in count.items():
  result[item[1]] += 1
result[0] = (h - 2) * (w - 2) - sum(result)
for one_result in result:
  print(one_result)
import math
A, B, H, M = map(int, input().split())

t = (H + (M / 60)) * pi / 6
m = (M / 60) * 2 *pi
totalangle = m - t
result = sqrt(A ** 2 + B ** 2 - 2 * A * B *cos(totalangle))
print(result)

### FIXED CODE ###

import math
 
A, B, H, M = map(int, input().split())
 
m = (M / 60) * 2 * math.pi
t = (H + (M / 60)) * math.pi / 6
angle = m-t
res = math.sqrt(A ** 2 + B ** 2 - 2 * A * B * math.cos(angle))
print(res)
n=int(input())
c=list(map(int,input().split()))
mod=10**9+7
c.sort()
c.reverse()
ans=0
x=pow(2,n-2,mod)
for i in range(n):
  ans+=c[i]*(i+2)*x
  ans%=mod
ans*=pow(2,n,mod)
ans%=mod
print(ans)

### FIXED CODE ###

import sys
n=int(input())
c=list(map(int,input().split()))
mod=10**9+7
if n==1:
  print(c[0]*2%mod)
  sys.exit()
c.sort()
c.reverse()
ans=0
x=pow(2,n-2,mod)
for i in range(n):
  ans+=c[i]*(i+2)*x
  ans%=mod
ans*=pow(2,n,mod)
ans%=mod
print(ans)
s=str(input())
if s[1]=='+':
   print(int(s[0])+int(s[2]))
else: 
    print(int(s[0])-int(s[2]))

### FIXED CODE ###

l=input().split()
a=int(l[0])
x=l[1]
b=int(l[2])
if(x=='+'):
    print(a+b)
else:
    print(a-b)
i = 1
while True:
    x = int(input().strip())
    if x == 0:
        break
    else:
        print ("Case" {}: {}).format(i,x)
        i += 1

### FIXED CODE ###

i = 1
while True:
    x = int(input().strip())
    if x == 0:
        break
    else:
        print ("Case {}: {}".format(i,x))
        i += 1
n,m=map(int,input().split())
ls=set(list(map(int,input().split()))[1:])
unique=ls.copy()
for i in range(n-1):
  A=list(map(int,input().split()))
  for j in ls:
    if j not in A[1:]:
      unique.remove(j)
print(len(unique))

### FIXED CODE ###

n,m=map(int,input().split())
ls=[0]*m
for i in range(n):
  A=list(map(int,input().split()))[1:]
  for j in A:
    ls[j-1]+=1
print(sum(list(map(lambda x:x//n,ls))))
s = str(input())
t = str(input())
count = 0
for i range(len(s)):
  if s[i] == t[i]:
  	pass
  else:
    count += 1
print(count)

### FIXED CODE ###

s=str(input())
t=str(input())
length=len(s)
count=0
for i in range(length):
	if s[i]==t[i]:
		pass
	else:
		count+=1
print(count)
n = int(input)
l = list(map(int, input().split()))
x = max(l)
s = sum(l)
if x < (s-x):
    print("Yes")

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
x = max(l)
s = sum(l)
if x < (s-x):
    print("Yes")
else:
    print("No")
from statistics import mean
from itertools import combinations
dist = lambda p1, p2: ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** (1 / 2)

N = int(input())
P = (tuple(map(int, input().split())) for _ in range(N))

distances = (dist(*combination) for combination in combinations(P, 2))
total_distance = (sum(distance) for distance in combinations(distances, N - 1))
print(mean(total_distance))

### FIXED CODE ###

from itertools import combinations
dist = lambda p1, p2: ((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2) ** (1 / 2)

N = int(input())
P = (tuple(map(int, input().split())) for _ in range(N))

distances = (dist(*combination) for combination in combinations(P, 2))
total_distance = tuple(sum(distance) for distance in combinations(distances, N - 1))
print(sum(total_distance) / len(total_distance))
import numpy as np

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

num_A = [A.count(i) for i in range(10)]

for i in range(Q):
    b, c = map(int, input().split())
    num_A[c] += num_A[b]
    num_A[b] = 0
    print(sum(np.array(num_A)*np.array([j for j in range(10)])))
    

### FIXED CODE ###

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

num_A = [0 for i in range(10**5+1)]
first = 0

for a in A:
    num_A[a] += 1
    first += a

for i in range(Q):
    b, c = map(int, input().split())
    first += c*num_A[b]
    first -= b*num_A[b]
    num_A[c] += num_A[b]
    num_A[b] = 0
    print(first)
N = int(input())
surveys = [list(map(int, input().split())) for _ in range(N)]
for x in range(101):
  for y in range(101):
    before = 0
    identified = True
    for survey in surveys:
      if survey[2] == 0:
        continue
      height = survey[2] + abs(x-survey[0]) + abs(y-survey[1])
      if before != 0 and before != height:
        identified = False
        continue
      before = height
    if identified:
      print(x, y, before)
      exit()


### FIXED CODE ###

N = int(input())
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A+B)
n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def count(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
        sayArray = sayTable[i]
		for x, y in sayArray:
			if y != honest[x] != y:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n;
		if checkHonestAll(sayTable, honest):
			return count(honest)
		else:
			return 0

	count = 0
	h = honest[i]
    sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i + 1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0));


### FIXED CODE ###

n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def countHonest(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if honest[x] == 0:
				continue
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		sayArray = sayTable[i]
		for x, y in sayArray:
			if y != honest[x]:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n:
		if checkHonestAll(sayTable, honest):
			return countHonest(honest)
		else:
			return 0

	count = 0
	h = honest[i]
	sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i+1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0))
S=int(input("S"))
W=int(input("W"))
if W>=S:
    print("unsafe")
else:
    print("safe")

### FIXED CODE ###

S,W=map(int,input().split())
if W>=S:
    print("unsafe")
else:
    print("safe")
a = int(input())
b = int(input())

s = (a + b) * 2
m = a * b
print(m, s)

### FIXED CODE ###

a, b = list(map(int, input().split()))
c = (a + b) * 2
d = a * b
print(str(d) + " " + str(c))
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())

if a.islower:
  print('a')
elif a.upper:
  print('A')


### FIXED CODE ###

# -*- coding: utf-8 -*-
a = str(input())
 
if 'a' <= a <= 'z':
  print('a')
if 'A' <= a <= 'Z':
  print('A')
A,B=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
flag=True
if S[0:A].isdecimal() != True:
    flag = False
elif S[A:B] != "-":
    flag = False
elif S[B:].isdecimal() != True:
    flag = False

if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from sys import stdin
A,B=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
flag=True
if S[:A].isdecimal() != True:
    flag = False
elif S[A:A+1] != "-":
    flag = False
elif S[A+1:].isdecimal() != True:
    flag = False

if flag:
    print("Yes")
else:
    print("No")
s = input()
n_s = len(s)
S = ''
for i in range(n_s):
    S += s[-i-1]
words = ["maerd", "remaerd", "esare", "resare"]
cnt = 0
result = 'Yes'
while True:
    if S[cnt:cnt+5] == 'maerd':
        cnt += 5
    elif S[cnt:cnt+5] == 'esare':
        cnt += 5
    elif S[cnt:cnt+6] == 'resare':
        cnt += 6
    elif S[cnt:cnt+7] == 'remaerd':
        cnt += 7
    else:
        result = 'No'
        break
    if cnt == n_S:
        break
print(result)

### FIXED CODE ###

s = input()
n_s = len(s)
S = ''
for i in range(n_s):
    S += s[-i-1]
words = ["maerd", "remaerd", "esare", "resare"]
cnt = 0
result = 'YES'
while True:
    if S[cnt:cnt+5] == 'maerd':
        cnt += 5
    elif S[cnt:cnt+5] == 'esare':
        cnt += 5
    elif S[cnt:cnt+6] == 'resare':
        cnt += 6
    elif S[cnt:cnt+7] == 'remaerd':
        cnt += 7
    else:
        result = 'NO'
        break
    if cnt == n_s:
        break
print(result)
n = int(input())
a = sorted(list(map(int, input().split())))
ans = sum(a) - a[n-1] / 2
print(ans)


### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, [input() for i in range(n)])))
ans = sum(a) - (a[n-1] / 2)
print(int(ans))
from collections import deque

MOD = 10 ** 9 + 7
ans = 1

n, k = map(int, input().split())
a = list(map(int, input().split()))

if n == k:
    for x in a:
        ans *= x
    print(ans % MOD)
    exit()

p = []
m = []

for x in a:
    if x >= 0:
        p.append(x)
    else:
        m.append(x)

p.sort(reverse=True)
m.sort()

pos = deque(p)
neg = deque(m)

if len(p) == 0:
    for i in range(k):
        ans *= neg[-1]
        neg.pop()
    print(ans % MOD)
    exit()

if k % 2:
    ans *= pos.popleft()
    k -= 1

while k > 0:
    if len(pos) >= 2:
        sp = pos[0] * pos[1]
    else:
        sp = 0
    
    if len(neg) >= 2:
        sn = neg[0] * neg[1]
    else:
        sn = 0
    
    if sp > sn:
        ans *= sp
        pos.popleft()
        pos.popleft()
    else:
        ans *= sn:
        neg.popleft()
        neg.popleft()
    
    ans %= MOD
    k -= 2

print(ans % MOD)


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))

MOD = 10 ** 9 + 7
ans = 1

#全部取る
if n == k:
    for x in a:
        ans *= x
        ans %= MOD
    print(ans % MOD)

#全部負かつ奇数個取る
elif max(a) < 0 and k % 2:
    a.sort()
    for i in range(1, k+1):
        ans *= a[-i]
        ans %= MOD
    print(ans % MOD)

else:
    pos = []
    neg = []
    
    for x in a:
        if x >= 0:
            pos.append(x)
        else:
            neg.append(x)
    
    pos.sort(reverse=True)
    neg.sort()
    
    
    if k % 2:
        ans *= pos.pop(0)
        k -= 1
     
    #2個ずつ取る
    num = []
    for x, y in zip(pos[::2], pos[1::2]):
        num.append(x * y)
    for x, y in zip(neg[::2], neg[1::2]):
        num.append(x * y)

    num.sort(reverse=True)

    for i in range(k // 2):
        ans *= num[i]
        ans %= MOD
    
    print(ans % MOD)
N,M,Q = map(int,input().split())
ls_rq = [list(map(int, input().split())) for i in range(Q)]

#深さ優先探索により各数列を生成する
As=[]
from queue import LifoQueue as lq
S=lq()
S.put([])
while not S.empty():
  a=S.get()
  if len(a)==N:
    As.append(a)
  else:
    if len(a)==0:
      b=1
    else:
      b=a[-1]
    for  i in range(b,M+1):
      S.put(a+[i])

#各数列のスコアを求める
ls_score=[]
for ls in As:
  score=0
  for j in range(Q):
    if ls[ls_rq[j][1]-1]-ls[ls_rq[j][0]-1]==ls_rq[j][2]:
      score+=ls_rq[j][3]
  ls_score.append(score)    
  score=0

#スコアの最大値を求める  
ans=max(ls_score)  
print(ans)  


### FIXED CODE ###

N=int(input())
A, B=map(int,input().split())
C=A//N
if A==C*N:
  print("OK")
elif A<=(C+1)*N<=B:
  print("OK")
else:
  print("NG")
print(1110-input())

### FIXED CODE ###

print(1110-int(input()))
a=sorted(list(int,input().split()))
print(a[2]*10+a[0]+a[1])

### FIXED CODE ###

a=sorted(list(map(int,input().split())))
print(a[2]*10+a[0]+a[1])
n,m=list(map(int, input().split() ))
ists=[]
for i in range(m):
  s=list(map(int,inout().split()))
  ists.append(s)
ans=0
justified=True
for j in range(n):
  for k in range(m):
    if ists[k][0]<=j<=ists[k][1]:
      continue
    else:
      justified=False
      break
  if justified:
    ans+=1
    justified=True

print(ans)
  


### FIXED CODE ###

n,m=list(map(int, input().split() ))
Firstlis=[]
Secondlis=[]
for i in range(m):
  s=list(map(int,input().split()))
  S1=s[0]
  S2=s[1]
  Firstlis.append(S1)
  Secondlis.append(S2)
Min=max(Firstlis)
Max=min(Secondlis)
if Max>=Min:
    print(Max-Min+1)
else:
    print(0)
s = input()
print('Bad' if true in [s[i] is s[i + 1] for i in 3] 'Good')

### FIXED CODE ###

s = input()
print('Bad' if True in [s[i] is s[i + 1] for i in range(3)] else 'Good')
n = int(input())
dll =[]
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.insert(0, command[1])
    elif command[0] == 'delete':
       # for i in range(len(dll)):
            #if dll[i] == command[1]: 
                #dll.pop(i)
                #break
        indexes = [i for i, x in enumerate(dll) if x == command[1]]
        dll.pop(indexes[0])
    elif command[0] == 'deleteFirst':
        dll.pop(0)
    else:
        dll.pop()

print(*dll)

### FIXED CODE ###

from collections import deque

n = int(input())
dll = deque()
for i in range(n):
    command = input().split()
    if command[0] == 'insert':
        dll.appendleft(command[1])
    elif command[0] == 'delete':
        try:
            dll.remove(command[1])
        except:
            pass
    elif command[0] == 'deleteFirst':
        dll.popleft()
    else:
        dll.pop()
print(*dll)
import heapq

n, x = [int(i) for i in input().split()]
t = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
tt = [[] for _ in range(10 ** 5 + 1)]
for i in range(n):
    tt[t[i]].append(-a[i])


def max_score(time):
    q = []
    heapq.heapify(q)
    for i in range(time, 10 ** 5 + 1):
        for j in tt[i]:
            heapq.heappush(q, j)

    ans = 0
    for i in reversed(range(time)):
        if q:
            ans += heapq.heappop(q)
        for j in tt[i]:
            heapq.heappush(q, j)
    return -ans


if max_score(10 ** 5) < x:
    print(-1)
    exit()

mi = 0
ma = 10 ** 5

while mi != ma:
    m = (mi + ma) // 2
    if max_score(m) >= x:
        ma = m
    else:
        mi += 1
print(mi)


### FIXED CODE ###

n, m = [int(i) for i in input().split()]
e = [[] for _ in range(n)]
for _ in range(m):
    a, b = [int(i)-1 for i in input().split()]
    e[a].append(b)
    e[b].append(a)

used = [False] * n
used[0] = True
ans1 = [1]
ans2 = []
i = 0
while True:
    for j in e[i]:
        if not used[j]:
            i = j
            ans1.append(j + 1)
            used[j] = True
            break
    else:
        break
i = 0
while True:
    for j in e[i]:
        if not used[j]:
            i = j
            ans2.append(j + 1)
            used[j] = True
            break
    else:
        break

ans = list(reversed(ans2)) + ans1

print(len(ans))
print(" ".join(map(str, ans)))
a,b,c = input().split()

if a[len(a)-1] == b[0] and if b[len(b)-1 == c[0]]:
    print('YES')
else:
    print(ans)

### FIXED CODE ###

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

if a[len(a)-1] == b[0] and b[len(b)-1] == c[0]:
    print('YES')
else:
    print('NO')
a, b =map(int,input().split())

answer = 1
num = 0
while(answer < b):
  anwer += a - 1
  num += 1
    
print(num)


### FIXED CODE ###

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

ans = 1
i = 0
while ans < B:
    ans += A - 1
    i += 1

print(i)
a, b = map(int, input(),split())
c = str(a) + str(b)
d = int(c)
if d ** 0.5 % 1 ==0 :
  print("Yes")
else:
  print("No")


### FIXED CODE ###

a, b = map(int, input().split())
print("Odd" if a * b % 2 else "Even")
import sys
tmp=input().split()
a=int(tmp[0])
b=int(tmp[1])
c=int(tmp[2])
d=int(tmp[3])
da=a-b
db=b-c
dc=c-a
if a-b<0:
    da=b-a
if b-c<0:
    db=c-b
if c-a<0:
    dc=a-c
if dc<=d or da<=d and db<d
    print('Yes')
    sys.exit()
print('No')


### FIXED CODE ###

import sys
tmp=input().split()
a=int(tmp[0])
b=int(tmp[1])
c=int(tmp[2])
d=int(tmp[3])
da=a-b
db=b-c
dc=c-a
if a-b<0:
    da=b-a
if b-c<0:
    db=c-b
if c-a<0:
    dc=a-c
if dc<=d or da<=d and db<=d:
    print('Yes')
    sys.exit()
print('No')
import sys
N, M = map(int, input().split())
route = [[] for i in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    route[a-1].append(b)
    
for i in route[0]:
    if len(route) != 1:
        for j in route[i-1]:
            if j == N:
                print('POSSIBLE')
                sys.exit()
    else:
        if i == N:
            print('POSSIBLE')
            sys.exit()
                
print('IMPOSSIBLE')


### FIXED CODE ###

import sys
N, M = map(int, input().split())
route = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    route[a-1].append(b)
    
for i in route[0]:
    if len(route) != 1:
        for j in route[i-1]:
            if j == N:
                print('POSSIBLE')
                sys.exit()
    else:
        if i == N:
            print('POSSIBLE')
            sys.exit()
                
print('IMPOSSIBLE')