Harryxun/stf_run huggingface dataset:
def visit(u):
    global color, d, f, t
    color[u] = GRAY
    d[u] += t
    t += 1
    for v in range(n):
        if (M[u][v] == 0):
            continue
        if (color[v] == WHITE):
            visit(v)
    color[u] = BLACK
    f[u] = t
    t += 1

n = int(input())
M = [[False for i in range(n)] for i in range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    for i in range(tmp[1]):
        M[tmp[0]-1][tmp[i+2]-1] = 1

WHITE = 0
GRAY = 1
BLACK = 2
color, d, f = [WHITE for i in range(n)]
t = 1
for u in range(n):
    if (color[u] == WHITE):
        visit(u)
for u in range(n):
    print(str(u+1), str(d[u]), str(f[u]), sep = " ")

### FIXED CODE ###

def dfs(u):
    global dfs_color, d, f, t
    color[u] = GRAY
    d[u] += t
    t += 1
    for v in range(n):
        if (M[u][v] == 0):
            continue
        else:
            if (color[v] == WHITE):
               dfs(v)
    color[u] = BLACK
    f[u] = t
    t += 1

n = int(input())
M = [[False for i in range(n)] for j in range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    for j in range(tmp[1]):
        M[tmp[0]-1][tmp[j+2]-1] = True

WHITE = 0
GRAY = 1
BLACK = 2
color = [WHITE for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
t = 1

for u in range(n):
    if (color[u] == WHITE):
        dfs(u)
for u in range(n):
    print(str(u+1), str(d[u]), str(f[u]), sep = " ")
N = int(input())
A = list(map(int, input().split()))
l1 = 0
l2 = 0
l4 = 0
for i in range(A):
  if(A[i] % 4 == 0):
    l4 += 1
  elif(A[i] % 2 == 0):
    l2 += 1
  else:
    l1 += 1
if(l4 < l1):
  print('No')
else:
  print('Yes')

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
l1 = 0
l2 = 0
l4 = 0
for i in range(len(A)):
  if(A[i] % 4 == 0):
    l4 += 1
  elif(A[i] % 2 == 0):
    l2 += 1
  else:
    l1 += 1
if(l2 == 0 and l4 + 1 == l1):
  print('Yes')
elif(l4 < l1):
  print('No')
else:
  print('Yes')
n=int(input())
List=[int(i) for i in input().split()]
print(Lint)
      
   

### FIXED CODE ###

n=int(input())
List=[int(i) for i in input().split()]
ans=0
for i in range(0,n-1):
  for r in range(i+1,n):
    a=List[i]
    b=List[r]
    ans=ans+a*b
print(ans)
a = int(input())
s = input()
if a < 3200:
  print('red')
else:
  print(s

### FIXED CODE ###

a = int(input())
s = input()
if a < 3200:
  print('red')
else:
  print(s)
N = int(input())
MAX=11000
S = [_+2 for _ in range(MAX)]
old = S
i = 0
while True:
  new = set([])
  t = old[i]
  for j in range(len(old)):
    if old[j] == t or old[j]%t != 0:
      new.add(old[j])
  if len(old) == len(new):
    break
  old = list(new)
  old.sort()
  i += 1


#print(old)
A = [0 for _ in range(MAX)]  
for i in range(MAX):
  if i%2 == 0:
    continue
  if i in new and (i+1)//2 in new:
    A[i] = 1
SUM = [0 for _ in range(MAX)] 
for i in range(1,MAX):
  SUM[i] += A[i]+SUM[i-1]
#print(SUM)

for i in range(N):
  l,r = map(int,input().split())
  ans = SUM[r]-SUM[l-1]
  print(ans)

### FIXED CODE ###

N = int(input())
MAX=110000
S = [_+2 for _ in range(MAX)]
old = S
i = 0
while True:
  new = set([])
  t = old[i]
  for j in range(len(old)):
    if old[j] == t or old[j]%t != 0:
      new.add(old[j])
  if len(old) == len(new):
    break
  old = list(new)
  old.sort()
  i += 1


#print(old)
A = [0 for _ in range(MAX)]  
for i in range(MAX):
  if i%2 == 0:
    continue
  if i in new and (i+1)//2 in new:
    A[i] = 1
SUM = [0 for _ in range(MAX)] 
for i in range(1,MAX):
  SUM[i] += A[i]+SUM[i-1]
#print(SUM)

for i in range(N):
  l,r = map(int,input().split())
  ans = SUM[r]-SUM[l-1]
  print(ans)
n=int(input())
M=['M','A','R','C','H']
S = {'M':0,'A':0,'R':0,'C':0,'H':0}
for _ in range(n):
  a = input()
  if a[0] in S:
  	S[a[0]] +=1
ANS=0
for i in range(n):
  for j in range(i+1,n):
    for k in range(j+1,n):
      ANS += (S[M[i]] * S[M[j]]* S[M[k]])
print(ANS)

### FIXED CODE ###

n=int(input())
M=['M','A','R','C','H']
S = {'M':0,'A':0,'R':0,'C':0,'H':0}
for _ in range(n):
  a = input()
  if a[0] in S:
  	S[a[0]] +=1
ANS=0
for i in range(len(M)):
  for j in range(i+1,len(M)):
    for k in range(j+1,len(M)):
      ANS += (S[M[i]] * S[M[j]]* S[M[k]])
print(ANS)
N = int(input())
W = list(map(int, input().split()))

l = W[0]
r = sum(W[1:])
diff = abs(l - r)
for i in range(1, N):
    l += W[i]
    r -= W[i]
    new_diff = abs(l-r)
    if new_diff < diff:
        diff = new_diff
print(diff)

### FIXED CODE ###

p,q,r = map(int, input().split())
l = [p,q,r]
l = sorted(l, reverse=True)
print(l[1] + l[2])
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, m = map(int, input().split())
ans = []
need = n//2 if n % 2 else (n - 1)//2
left_range = need
right_range = need - 1
left1 = 1
right1 = 1 + left_range
left2 = right1 + 1
right2 = left2 + right_range

for i in range(left_range):
    left1 += i
    right1 -= i
    if left1 >= right1:
        break
    ans.append([left1, right1])

for i in range(right_range):
    left2 += i
    right2 -= i
    if left2 >= right2:
        break
    ans.append([left2, right2])
    
for i in range(m):
    print(*ans[i])    




### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, m = map(int, input().split())
if n % 2 == 0:
    n -= 1
ans = []
left_range = n//2
right_range = n//2 - 1
left1 = 1
right1 = 1 + left_range
left2 = right1 + 1
right2 = left2 + right_range

while True:
    if left1 >= right1:
        break
    ans.append([left1, right1])
    left1 += 1
    right1 -= 1

while True:
    if left2 >= right2:
        break
    ans.append([left2, right2])
    left2 += 1
    right2 -= 1
    
for i in range(m):
    print(*ans[i])
n = input()

print(n*n*n)

### FIXED CODE ###

n = int(input())
print(n*n*n)
N, Q = map(int, input().split())

G=[[0]*N]
ans =[0]*N
for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1] = b-1
    G[b-1] = a-1

for i in range(Q):
    p, x = map(int, input().split())
    for j in range(len(G[p-1])):
        ans[j] += x

print(*ans, sep=" ")

### FIXED CODE ###

from collections import deque

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

G=[[] for i in range(N)]
A =[0]*N

for i in range(N-1):
    a, b = map(int, input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)

for i in range(Q):
    p, x = map(int, input().split())
    A[p-1] += x

queue = deque([0])
visited= [0]*N
while queue:
    a = queue.popleft()
    visited[0] = 1
    for i in G[a]:
        if visited[i] == 0:
            A[i] += A[a]
            visited[a] = 1
            queue.append(i)

print(*A)
A = int(input())
B = int(input())
T = int(input())

count = 0
x = int((T+0.5)/A)
for i in range(1,x+1):
    count += B

print(count)

### FIXED CODE ###

A, B, T = (int(i) for i in input().split())

count = 0
for i in range(0, int(T/A)):
    count += B

print(count)
def main():
    a,b,k = map(int, input().split())

    array = list(range(a,b+1))
    ans = list(set(array[:k]) | set(array[-k:]))
    ans.sort()
    for val in ans:
        print(val)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    a,b,k = map(int, input().split())

    array = range(a,b+1)
    ans = list(set(array[:k]) | set(array[-k:]))
    ans.sort()
    for val in ans:
        print(val)


if __name__ == '__main__':
    main()
from functools import lru_cache
N, M = map(int, input().split(' '))

@lru_cache(maxsize=None)
def fib(n):
    a, b = 0, 1
    for i in range(0, n):
        a, b = b, a + b
    return a

a_p = int(input())
sum = fib(a_p%1000000007)
sum %= 1000000007
for i in range(M-1):
    a = int(input())
    diff = a - a_p
    if diff == 1:
        print('0')
        exit()
    sum *= fib((diff-1)%1000000007)
    sum %= 1000000007
    a_p = a

if (N - a_p == 1):
    print('0')
    exit()

sum *= fib(N - a_p)
sum %= 1000000007
print(sum)


### FIXED CODE ###

N, M = map(int, input().split(' '))

MOD = 1000000007

def fib(n):
    a, b = 0, 1
    for i in range(0, n):
        a, b = b, a + b
    return a

broken_step = []
p_a = -1
for i in range(M):
    a = int(input())
    if (a - p_a == 1):
        print("0")
        exit()
    else:
        p_a = a
    broken_step.append(a-1)

count_0 = 0
count_1 = 1
next_broken = 0
pre_is_broken = False
for i in range(N):
    if (next_broken >= len(broken_step) or i != broken_step[next_broken]):
        if (pre_is_broken):
            count_0 = 0
            pre_is_broken = False
        else:
            count_0, count_1 = count_1, count_0 + count_1
            count_0 %= MOD
            count_1 %= MOD
    else:
        next_broken+=1
        count_0 = 0
        pre_is_broken = True

print(count_1)
a=list(map(int,input().split())
print(a.index(0)+1)

### FIXED CODE ###

a=list(map(int,input().split()))
print(a.index(0)+1)
# C - Remainder Minimization 2019
import numpy as np

l, r = map(int, input().split())

a = np.arange(l, r+1)
a = a%2019
a = np.sort(a)

print(a[0]*a[1])

### FIXED CODE ###

# C - Remainder Minimization 2019
import numpy as np

l, r = map(int, input().split())

ans = 2019
for i in range(l,r):
    for j in range(i+1, r+1):
        ans = min(ans, (i*j)%2019)
        if ans==0:
            break
    else:
        continue
    break

print(ans)
# -*- coding: utf-8 -*-

if X < A:
　print('0')
else:
　print('10')

### FIXED CODE ###

X, A = map(int, input().split())
 
if X < A:
 print(0)
else:
 print(10)
import sys

word = sys.argv[1]
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
    sys.exit(0)
print('No')



### FIXED CODE ###

word = list(input())
if word[2]==word[3] and word[4]==word[5]:
    print('Yes')
else: print('No')
N=int(input())
s=0
S=str(N):
for i in S:
    s+=i
if S%s==0:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N=int(input())
s=0
S=str(N)
for i in S:
    s+=int(i)
if N%s==0:
    print("Yes")
else:
    print("No")
n, m = list(map(int, input().split()))

MOD = pow(10, 9) + 7

dp = [0] * (n+1)

dp[0] = 1

broken = int(input())
c = 1

for i in range(1, n+1):
    if i == broken:
        dp[i] = 0
        if c < m:
            broken = int(input())
            c += 1
    else:
        if i == 1:
            dp[i] = dp[i-1] % MOD
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % MOD

print(dp[n] % MOD) 


### FIXED CODE ###

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

MOD = pow(10, 9) + 7

dp = [0] * (n+1)

dp[0] = 1

broken = [False] * (n+1)
for i in range(m):
    broken[int(input())] = True

c = 1

for i in range(1, n+1):
    if broken[i]:
        dp[i] = 0
    else:
        if i == 1:
            dp[i] = dp[i-1] % MOD
        else:
            dp[i] = (dp[i-1] + dp[i-2]) % MOD

print(dp[-1] % MOD)
import numpy as np 
s = input()
fis = s[0]
n = len(s)
k = float('inf')
temp = s[0]
for i in range(n):
    if temp!=s[i]:
        temp = s[i]
        k = np.min((k, np.max( (i, n-i) ) ))
print("{}".format(int(k)))

### FIXED CODE ###

import numpy as np 
s = input()
fis = s[0]
n = len(s)
k = n
temp = s[0]
for i in range(n):
    if temp!=s[i]:
        temp = s[i]
        k = np.min((k, np.max( (i, n-i) ) ))
print("{}".format(int(k)))
N = input()
S = input()
t = []
for i in S:
    if ord(i) + N >= 91:
        t.append(chr(ord(i) + N - 26))
    else:
        t.append(chr(ord(i) + N))
print(t)

### FIXED CODE ###

N = int(input())
S = input()
t = []
for i in S:
    if ord(i) + N >= 91:
        t.append(chr(ord(i) + N - 26))
    else:
        t.append(chr(ord(i) + N))
print(''.join(t))
import sympy
N=int(input())
count=0
for i in range(1,N):
  count=count+sympy.divisor_count(i)
print (count)

### FIXED CODE ###

N=int(input())
a=1
count=0
while a<N:
  count=count+(N-1)//a
  a=a+1
else:
  print(count)
a = raw_input()
b, c, d = a.split()
B = int(b)
C = int(c); D = int(d)
 
if x <= y <= z: print x, y, z
elif x <= y > z: print x, z, y
elif y <= x <= z: print y, x, z
elif y < z <= x: print y, z, x
elif y < x: print z, y, x
else: print z, x, y

### FIXED CODE ###

a = raw_input()
b, c, d = a.split()
x = int(b)
y = int(c); z = int(d)
  
if x <= y <= z: print x, y, z
elif x <= y > z: print x, z, y
elif y <= x <= z: print y, x, z
elif y < z <= x: print y, z, x
elif y < x: print z, y, x
else: print z, x, y
from collections import deque

class Node:
    def __init__(self):
        self.size = 1  # 自分以下のノードの数
        self.children = []

def dfs(v):
    V = Node()
    visited[v] = True
    for u in AL[v]:
        if visited[u]: continue
        U = dfs(u)
        V.size += U.size
        V.children.append(U)
    return V

def anaaki(V):
    ret = pow(2, n - 1, p) - 1
    for ch in V.children:
        ret -= pow(2, ch.size) - 1
        ret %= p
    ret -= pow(2, n - V.size) - 1
    ret %= p
    return ret

n = int(input())
AL = [[] for _ in range(n)]
visited = [False] * n
p = 10 ** 9 + 7
for i in range(n - 1):
    a, b = [int(x) - 1 for x in input().split()]
    AL[a].append(b)
    AL[b].append(a)

# dfs
root = dfs(0)
que = deque([root])
numer = 0
while que:
    next = que.popleft()
    numer += anaaki(next)
    numer %= p
    for ch in next.children:
        que.append(ch)

denom = pow(2, n, p)

print( numer * pow(denom, p - 2, p) % p)

### FIXED CODE ###

# classを使うのをやめてlistで実施する
from collections import deque
import sys
sys.setrecursionlimit(10 ** 9)
import sys
input = sys.stdin.readline

def dfs(v):
    visited[v] = True
    for i in range(len(AL[v][CHILDREN])):
        u = AL[v][CHILDREN][i]
        if visited[u]:
            AL[v][CHILDREN][i] = None
            continue
        AL[v][SIZE] += dfs(u)
    return AL[v][SIZE]


def anaaki(v):
    ret = powp - 1
    for ch in AL[v][CHILDREN]:
        if ch is None: continue
        ret -= pow(2, AL[ch][SIZE], p) - 1
        ret %= p
    ret -= pow(2, n - AL[v][SIZE], p) - 1
    ret %= p
    return ret

n = int(input())
SIZE = 0
CHILDREN = 1
AL = [[1, []] for _ in range(n)]
visited = [False] * n
p = 10 ** 9 + 7
powp = pow(2, n - 1, p)

for i in range(n - 1):
    a, b = [int(x) - 1 for x in input().split()]
    AL[a][CHILDREN].append(b)
    AL[b][CHILDREN].append(a)

dfs(0)
numer = 0
for i in range(n):
    numer += anaaki(i)
    numer %= p

denom = pow(2, n, p)
print(numer * pow(denom, p - 2, p) % p)
N = int(input())
if N % 2 == 0:
  print(0.5000000000)
else:
  print(float((N+1)/2N))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  print(0.5000000000)
else:
  print((N+1)/(2*N))
N = input()
L = list(input())
count = 0

for i in range(N-2):
    Li = L[i]
    for j in range(i+1, N-1):
        Lj = L[j]
        for k in range(j+1, N):
            Lk = L[k]
            if (Li == Lj) or (Lj == Lk) or (Lk == Li):
                continue
            else:
                if ((Li + Lj) >= Lk) and ((Li + Lk) >= Lj) and ((Lk + Lj) >= Li):
                    count = count + 1
print(count)

### FIXED CODE ###

N =int(input())
L=list(map(int, input().split()))
LL = sorted(L)
count=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if LL[i]+LL[j]>LL[k]:
                if (LL[i]!=LL[j])and(LL[j]!=LL[k]):
                    count += 1
print(count)
A = int(input())
B = int(input())
C = int(input())

print('Yes') if A+B >= C else print('No')

### FIXED CODE ###

A,B,C=map(int,input().split())
print('Yes') if A+B >= C else print('No')
x = input().splite(" ")
print str(x[0]*x[1]) + " " + str(x[0]*2 + x[1]*2)

### FIXED CODE ###

(x, y) = map(int, raw_input().split())
print x * y, 2 * (x + y)
N = int(input())

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

if 0 in A:
    print(0)
    exit()

limit = 10**18

result = 1
for value in A:
    result *= value
    if result > limit:
        result = -1
        break

print(result)

### FIXED CODE ###

N = int(input())

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

if 0 in A:
    print(0)
    exit()

limit = 10**18

result = 1
for value in A:
    result *= value
    if result > limit:
        result = -1
        break

print(result)
import sys
sys.setrecursionlimit(10000000)

n, x = map(int, input().split())

num = [0] * (n + 1)
num_p = [0] * (n + 1)
num_h = [0] * (n + 1)
num[0] = 1
num_p[0] = 1

for i in range(1, n + 1):
    num[i] = num[i - 1] * 2 + 3
    num_p[i] = num_p[i - 1] * 2 + 1

for i in range(n + 1):
    num_h[i] = num[i] // 2 + 1

def memoize(f): #メモ化関数
    table = {}
    def func(*args):
        if not args in table:
            table[args] = f(*args)
        return table[args]
    return func

# idx 番目までに含むPの数を返す
@memoize
def func(idx, n):
    if idx <= n:
        ret = 0

    if idx == num_h[n]:
        ret = num_p[n - 1] + 1

    if idx > num_h[n]:
        ret = num_p[n] - func(num[n] - idx, n)

    if idx < num_h[n - 1]:
        ret = func(x, n)

    return ret

print(func(x, n))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)

n, x = map(int, input().split())

num = [0] * (n + 1)
num_p = [0] * (n + 1)
num_h = [0] * (n + 1)
num[0] = 1
num_p[0] = 1

for i in range(1, n + 1):
    num[i] = num[i - 1] * 2 + 3
    num_p[i] = num_p[i - 1] * 2 + 1

for i in range(n + 1):
    num_h[i] = num[i] // 2 + 1

# idx 番目までに含むPの数を返す
def func(idx, n):
    if idx == 1 and n == 0:
        return 1
    if idx == 1 and n == 1:
        return 0
    if idx <= n or n < 0:
        return 0

    if idx == num_h[n]:
        ret = num_p[n - 1] + 1

    elif idx > num_h[n]:
        ret = num_p[n] - func(num[n] - idx - 1, n - 1)

    elif idx < num_h[n]:
        ret = func(idx - 1, n - 1)

    return ret

print(func(x, n))
#!/usr/bin/env python3
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
r.sort()
ans = sum(p[-x:])+sum(q[-y:])
x_pos = -x
y_pos = -y
for i in range(c):
    #したから見ていく
    if min(p[x_pos],q[y_pos]) >= r[i]:
        continue
    elif p[x_pos] > q[y_pos]:
        ans += r[i] - q[y_pos]
        y_pos -= 1
    else:
        ans += r[i] - p[x_pos]
        x_pos -= 1
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
x,y,a,b,c = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort()
q.sort()
z = p[-x:]
z.extend(q[-y:])
z.extend(r)
z.sort()
#print(z)
print(sum(z[-x-y:]))
class UnionFind:
    def __init__(self, length):
        self.par = [-1 for _ in range(length)]

    def root(self,x):
        if (self.par[x] < 0 ):
             return x
        else:
            #change connection 
            self.par[x] =self.root(self.par[x])
            return self.par[x]
    
    def unite(self,x,y):
        root_x = self.root(x)
        root_y = self.root(y)
        if (root_x==root_y):
            pass
        else:
            self.par[root_y] += self.par[root_x]
            self.par[root_x] = root_y
        
    def same(self,x,y):
        root_x = self.root(x)
        root_y = self.root(y)
        return root_x == root_y 
    
    def size(self,x):
        return -self.par[self.root(x)]

"""
uf = UnionFind(5)
uf.unite(3,4)
uf.unite(1,2)
uf.unite(1,4)
print(uf.size_dict)
"""


N,M = [ int(i) for i in input().split(" ")]
edges = [ tuple([ int(num)-1 for num in  input().split(" ")]) for _ in range(M) ]
score= N*(N-1)//2
outputs = [score]
uf = UnionFind(N)
for edge in edges[::-1]:
    if not uf.same(*edge):
        score -= uf.size(edge[0]) * uf.size(edge[1])
        uf.unite(*edge)
    outputs.append(score)
for i in range(M):
    print(int(outputs[M-i-1]))



### FIXED CODE ###

class UnionFind:
    def __init__(self, length):
        self.par = [-1 for _ in range(length)]
        self.rank = [0 for _ in range(length)]
 
    def root(self,x):
        if (self.par[x] < 0 ):
             return x
        else:
            #change connection
            root = self.root(self.par[x])
            self.par[x] = root
            return root
    
    def unite(self,x,y):
        root_x = self.root(x)
        root_y = self.root(y)
        if (root_x==root_y):
            return 
        else:
            if self.rank[root_x] < self.rank[root_y]:
                self.par[root_y] += self.par[root_x]
                self.par[root_x] = root_y

            else:
                self.par[root_x] += self.par[root_y]
                self.par[root_y] = root_x
                if self.rank[root_x] == self.rank[root_y]:
                    self.rank[root_x]+=1
        
    def same(self,x,y):
        root_x = self.root(x)
        root_y = self.root(y)
        return root_x == root_y 
    
    def size(self,x):
        return -self.par[self.root(x)]

"""
uf = UnionFind(5)
uf.unite(3,4)
uf.unite(1,2)

uf.unite(1,4)
print(uf.size_dict)
"""
def solve(edges,N,M):
 
    score= N*(N-1)//2
    outputs = [score]
    uf = UnionFind(N)
    for edge in edges[::-1]:
        if not uf.same(*edge):
            score -= uf.size(edge[0]) * uf.size(edge[1])
            uf.unite(*edge)
        outputs.append(score)
    for i in range(M):
        print(int(outputs[M-i-1]))

def get_input():
    N,M = map(int, input().split())
    edges = [tuple(map(lambda x:  int(x)-1, input().split())) for _ in range(M)]
    return N,M,edges

N,M,edges = get_input()
# = 10**6
#M=10**5
#import numpy as np
#edges = [(np.random.randint(N),np.random.randint(N)) for i in range(M)]
solve(edges,N,M)
import math
x = 0.0
y = 0.0
while True:
    m, r = map(int, raw_input().split(","))
    if m == 0 and r == 0:
        break
    theta += r
    rad = theta/180*math.pi
    x += m*math.cos(rad)
    y += m*math.sin(rad)
    
print int(x)
print int(y)

### FIXED CODE ###

import math
x = 0.0
y = 0.0
theta = 90.0
while True:
    m, r = map(int, raw_input().split(","))
    if m == 0 and r == 0:
        break
    rad = theta/180*math.pi
    x += m*math.cos(rad)
    y += m*math.sin(rad)
    theta += -r
    
print int(x)
print int(y)
def search(x, num):
    search_list = []
    for y in edge[x]:
        if y in nodes:
            nodes.remove(y)
            edge[y].discard(x)
            search_list.append(y)
    for y in search_list:
        num = search(y, num)
    return num + 1


(n,m),*d  = [list(map(int, s.split())) for s in open(0)]

edge = [set() for _ in range(n+1)]
for x in d:
    edge[x[0]].add(x[1])
    edge[x[1]].add(x[0])

nodes = set(range(1,n+1))
ans = 1
for x in range(1,n+1):
    if x not in nodes:
        continue
    tmp = search(x, 0)
    ans = max(tmp, ans)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(int(1e6))

def search(x, num):
    nodes.remove(x)
#     for y in edge[x]:
#         edge[y].discard(x)
#     for y in list(edge[x]):
    for y in edge[x]:
        if y in nodes:
            num = search(y, num)
    return num + 1

(n,m),*d  = [list(map(int, s.split())) for s in open(0)]

edge = [set() for _ in range(n+1)]
for x in d:
    edge[x[0]].add(x[1])
    edge[x[1]].add(x[0])

nodes = set(range(1,n+1))
ans = 1
for x in list(nodes):
    if x in nodes:
        ans = max(ans, search(x, 0))
print(ans)
import math
a, b, c = map(int, input().split())

# 容器に入っている水が半分以下の場合に困る
a = [2]
if a*a*b > 2 * c:
    print(a[4])
    h = (2*c)/(a*a)
    print(math.degrees(math.acos(h/a)))
else:
    h = 2*(a*a*b-c)/(a**2)
    print(math.degrees(math.atan(h/a)))


### FIXED CODE ###

from math import atan, degrees
a, b, x = map(int, input().split())

if 2*x >= a*a*b:
    h = 2*(a*a*b-x)/(a*a)
    print(degrees(atan(h/a)))
else:
    l = 2*(a*a*b-x)/(a*b) - a
    print(degrees(atan(b/(a-l))))
#include <iostream>
#include <vector>
using namespace std;

int main(){
  int N;
  cin >> N;
  vector<double> A(N);
  for(int i=0; i<N; i++)
    cin >> A[i];

  double sum_recip = 0.0;

  for(int i=0; i<N; i++)
    sum_recip += 1 / A[i];

  cout << 1 / sum_recip << endl;
}


### FIXED CODE ###

N = int(input())
input_str = input()
array_strs = input_str.split(" ")
sum_recip = 0.0

for i in range(N):
    sum_recip += 1 / float(array_strs[i])

print(1 / sum_recip)
import math
N,D = map(int,input().split(" "))
count=0
for _ in range(N):
  p,q=map(int,input().split(" "))
  if (p*p + q*q)<=D*D:
    count+=1
print(count)

### FIXED CODE ###

X=int(input())

if X>=30:
  print("Yes")
else:
  print("No")