Harryxun/stf_run huggingface dataset:
N = input()
p = 0
while N % 2 == 0 :
  N //= 2
  p += 1
print(p)

### FIXED CODE ###

a = 0
ans = 0
N = int(input())
for i in range(1, N+1) :
  p = 0
  x = i
  while x % 2 == 0 :
    x //= 2
    p += 1
  if a <= p :
    a = p
    ans = i
print(ans)
N = (int, input())
N//3

### FIXED CODE ###

N = int(input())
print(N//3)
n = int(input())
a = list(map(int, input().split( )))
ans = 0
mod = 10**9+7
Bit = [0 for j in range(60)]# for i in range(n+1)
for j in range(60):#ループ交換
	for i in range(1,n):##1から

        if not ((a[i-1]>>j)&1):#a[i-1]のjビット目0
            Bit[j] += 1
        if ((a[i]>>j)&1):#aiのjビット目1
            ans += Bit[j]<<j
            ans %=mod
        else:
            ans += (i-Bit[j])<<j
            ans %= mod
    
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split( )))
ans = 0
mod = 10**9+7
Bit = [0 for j in range(60)]# for i in range(n+1)
for j in range(60):#ループ交換
    for i in range(1,n):##1から
        if not ((a[i-1]>>j)&1):#a[i-1]のjビット目0
            Bit[j] += 1
        if ((a[i]>>j)&1):#aiのjビット目1
            ans += Bit[j]<<j
            ans %=mod
        else:
            ans += (i-Bit[j])<<j
            ans %= mod
    
print(ans)
# -*- coding: utf-8 -*-
n = int(input())
a = int(input())

print('Yes' if n%500 =< a else 'No')

### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())
a = int(input())

print('Yes' if n%500 <= a else 'No')
a = map(int, input().split())
a.sort()
print(a[0:])

### FIXED CODE ###

a = list(map(int, input().split()))
a.sort()
print(str(a[0]) + " " + str(a[1]) + " " + str(a[2]))
x,y,z,w=map(int,input().split())

while True:
    z=z-y
    if z<=0:
        print("Yes")
        break
    x=x-w
    if x<=0:
        print("No")
        break

### FIXED CODE ###

S,W=map(int,input().split())
 
if S>W:
	print("safe")
else:
	print("unsafe")
s = input()
#l = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
l = []
roll = ord('z')-ord('a')

for i in range(roll):
    l.append(0)

for i in range(len(s)):
    num = ord(s[i])
    l[num-97] += 1
    #print(num)

for i in range(roll):
    if l[i]%2 != 0:
        print("No")
        exit()
else:
    print("Yes")

### FIXED CODE ###

s = input()
#l = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
l = []
roll = ord('z')-ord('a')+1

for i in range(roll):
    l.append(0)

for i in range(len(s)):
    num = ord(s[i])
    l[num-97] += 1
    #print(num)

for i in range(roll):
    if l[i]%2 != 0:
        print("No")
        break
else:
    print("Yes")
X,Y,Z = map(int,input.split(" "))
ans = (X-Z)//(Y+Z)
print(ans)

### FIXED CODE ###

X,Y,Z = map(int,input().split(" "))
ans = (X-Z)//(Y+Z)
print(ans)
import bisect
import heapq
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N, Q = list(map(int, input().split()))
STX = [list(map(int, input().split())) for _ in range(N)]
D = [int(input()) for _ in range(Q)]

# (d, x, x のインデックス) のリスト
lows = []
highs = []

for xi, [s, t, x] in enumerate(STX):
    # [lo, hi) に出発した人は x で止まる
    lo = bisect.bisect_left(D, s - x)
    hi = bisect.bisect_left(D, t - x)
    lows.append((D[lo], x, xi))
    highs.append((D[hi], x, xi))

lows.sort()
highs.sort()
L = 0
r = 0
# (x, D のインデックス)
heap = []
used = set()

for i, d in enumerate(D):
    while L < len(lows) and lows[L][0] <= d:
        heapq.heappush(heap, (lows[L][1], lows[L][2]))
        L += 1
    while r < len(highs) and highs[r][0] <= d:
        used.add(highs[r][2])
        r += 1
    while heap and heap[0][1] in used:
        heapq.heappop(heap)
    if heap:
        print(heap[0][0])
    else:
        print(-1)


### FIXED CODE ###

import bisect
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

N, Q = list(map(int, next(sys.stdin).split()))
STX = [list(map(int, next(sys.stdin).split())) for _ in range(N)]
D = [int(next(sys.stdin)) for _ in range(Q)]

ans = [-1 for _ in range(Q)]
nexts = [-1 for _ in range(Q)]

for s, t, x in sorted(STX, key=lambda stx: (stx[2], stx[1])):
    # [lo, hi) に出発した人は x で止まる
    # x の小さい順にソート済みなのでここで確定
    lo = max(0, bisect.bisect_left(D, s - x))
    hi = min(len(D), bisect.bisect_left(D, t - x))

    p = lo
    while p < hi:
        if nexts[p] == -1:
            ans[p] = x
            nexts[p] = hi
            p += 1
        else:
            prev = p
            p = nexts[p]
            nexts[prev] = hi

for a in ans:
    print(int(a))
N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[]
for i in L:
  D.append(D[-1]+i)
  if D[-1]>X:
    print(len(D)-1)
    break

### FIXED CODE ###

N,X=map(int,input().split())
L=list(map(int,input().split()))
D=[0]
cnt=0
for i in L:
  D.append(D[-1]+i)
for i in D:
  if i<=X:
    cnt+=1
print(cnt)
import sys
lines = sys.stsin.readlines()
K, N = list(map(int, lines[0].srtip().split()))
As = list(map(int, lines[1].strip().split()))

diffs =[]
for base, switch in zip(arr[:-1], arr[1:]):
  diffs.append(switch-base)

diffs.append(arr[0]+K-arr[-1])

print(K-max(diffs))

### FIXED CODE ###

K, N = list(map(int, input().split()))
As = list(map(int, input().split()))
diffs =[]
for base, switch in zip(As[:-1], As[1:]):
  diffs.append(switch-base)
diffs.append(As[0]+K-As[-1])
print(K-max(diffs))
n, m = map(int, input().split())
l = []
for i in range(m):
    l, r = map(int, input().split())
    l.append(list(range(l, m + 1)))
c = [0] * n
for i in range(m):
    for j in range(n):
        if (j + 1) in l[i]:
            c[j] += 1
counr = 0
for i in c:
    if m == c[i]:
        count += 1
print(count)

### FIXED CODE ###

n, m = map(int, input().split())
L = []
R = []
for i in range(m):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
count = min(R) - max(L) + 1
if count <= 0:
    print(0)
else:
    print(count)
N, L, T=map(int, input().split())
XW=[list(map(int, input().split())) for _ in range(N)]
X_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)]
X_.sort()
A0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L
P0_=X_.index(A0_)
if P0_>0:
    X_=X_[P0_:]+X_[:P0_]
    
if XW[0][1]==1:
    C0_=round(sum([(T-(XW[i][0]-XW[0][0])/2)//(L/2)+1 if XW[i][1]!=1 and (XW[i][0]-XW[0][0])/2<=T else 0 for i in range(1, N)])%N)
else:
    C0_=round(N-sum([(T-(XW[0][0]+L-XW[i][0])/2)//(L/2)+1 if XW[i][1]!=2 and (XW[0][0]+L-XW[i][0])/2<=T else 0 for i in range(1, N)])%N)
    
if X_[0]==X_[1] and XW[0][1]==1:
  C0_-=1
  
if C0_>0:
  X_=X_[N-C0_:]+X_[:N-C0_]
print(*X_, sep='\n')

### FIXED CODE ###

N, L, T=map(int, input().split())
XW=[list(map(int, input().split())) for _ in range(N)]
X_=[(XW[i][0]+T)%L if XW[i][1]==1 else (XW[i][0]-T)%L for i in range(N)]
X_.sort()
A0_=(XW[0][0]+T)%L if XW[0][1]==1 else (XW[0][0]-T)%L
P0_=X_.index(A0_)
if P0_>0:
    X_=X_[P0_:]+X_[:P0_]
    
if XW[0][1]==1:
    C0_=round(sum([(T-(XW[i][0]-XW[0][0])/2)//(L/2)+1 if XW[i][1]!=1 and (XW[i][0]-XW[0][0])/2<=T else 0 for i in range(1, N)])%N)
else:
    C0_=round(N-sum([(T-(XW[0][0]+L-XW[i][0])/2)//(L/2)+1 if XW[i][1]!=2 and (XW[0][0]+L-XW[i][0])/2<=T else 0 for i in range(1, N)])%N)
    
if N>1 and X_[0]==X_[1] and XW[0][1]==1:
  C0_=round((C0_-1)%N)

if C0_>0:
  X_=X_[N-C0_:]+X_[:N-C0_]

print(*X_, sep='\n')
s=input()

if (s[0]==s[2] and s[1]==s[3]) or (s[0]==s[1] and s[2]==s[3]) or (s[0]==s[3] and s[1]==s[2]) 
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s=input()

if s[0]==s[1] and s[0]==s[2] and s[0]==s[3]:
    print("No")
elif(s[0]==s[2] and s[1]==s[3]) or (s[0]==s[1] and s[2]==s[3]) or (s[0]==s[3] and s[1]==s[2]):
    print("Yes")
else:
    print("No")
oppai,tintin,manman=map(int,input().split())
print((oppai-tintin)%manman)

### FIXED CODE ###

X=int(input())
A=int(input())
B=int(input())
print((X-A)%B)
from fraction import gcd

n = int(input())
a = list(map(int, input().split()))
x = a[0]
for i in range(1, n):
    x = gcd(x, a[i])
    if x == 1:
        break
print(x)


### FIXED CODE ###

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

n = int(input())
a = list(map(int, input().split()))
x = a[0]
for i in range(1, n):
    x = gcd(x, a[i])
print(x)
import numpy as np

# input
N, M, K = map(int, input().split())

Frends = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    if a < b:
        Frends[a].append(b)
    else:
        Frends[b].append(a)

Blocked = [[] for _ in range(N)]
for _ in range(K):
    c, d = map(int, input().split())
    if c < d:
        Blocked[c].append(d)
    else:
        Blocked[d].append(c)
# process
# 友人グループを作成
fg = []
for i in range (1, N):
    fs = Frends[i]
    for f in fs:
        t = -1
        for j in range(len(fg)):
            g = fg[j]
            if i in g and f in g:
                if t < 0:
                    t = j
                else:
                    fg[t] = np.union1d(fg[t], g)
                    fg.pop(j)
            elif not (i in g or f in g):
                continue
            else:
                if t < 0:
                    t = j
                    if i in g:
                        fg[j] = np.append(g, f)
                    else:
                        fg[j] = np.append(g, i)
                else:
                    fg[t] = np.union1d(fg[t], g)
                    fg.pop(j)

        if t < 0:
            fg.append(np.array([i, f]))

# 友人候補を抽出
cand = []
for i in range(1, N):
    for g in fg:
        if i in g:
            for f in g:
                if i < f and not f in Frends[i] and not f in Blocked[i]:
                    cand.append((i, f,))

# 友人候補をカウント
ans = [0 for _ in range(N+1)]
for c in cand:
    a, b = c
    ans[a] += 1
    ans[b] += 1

# output
#print(fg)
#print(cand)
print(" ".join(map(str, ans[1:])))


### FIXED CODE ###

# input
N, M, K = map(int, input().split())

Friends = [set() for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    Friends[a].add(b)
    Friends[b].add(a)

Blocked = [set() for _ in range(N)]
for _ in range(K):
    c, d = map(int, input().split())
    c -= 1
    d -= 1
    Blocked[c].add(d)
    Blocked[d].add(c)

# process
# 友人グループを作成
checked = set()
ans = [0]*N

for i in range (N):
    if i in checked:
        continue
    
    fg = set()

    stack = list(Friends[i])
    while stack:
        f = stack.pop()
        if f in checked:
            continue

        checked.add(f)
        fg.add(f)
        stack.extend(Friends[f])

    for f in fg:
        ans[f] += len(fg)-1-len(fg&(Friends[f]|Blocked[f]))

# output
print(" ".join(map(str, ans)))
//h w
//abc
//arc
#include <iostream>
#include <string>
using namespace std;
int main(){
 int h, w;
 cin >> h >> w;
 string result = "";
 for(int i = 0; i < w + 2; i++) result += "#";
 result += "\n";
 for(int i = 0; i < h; i++){
  string s; cin >> s;
  result += "#" + s + "#\n";
 }
 for(int i = 0; i < w + 2; i++) result += "#";
 result += "\n";
 cout << result << endl;
}


### FIXED CODE ###

h, w = map(int, input().split())

ans_wsplit = [max(abs((i * w) - (((h - i) + 1) // 2) * w), abs((i * w) - ((h - i) // 2) * w)) for i in range(1, h)]
ans_hsplit = [max(abs((i * h) - (((w - i) + 1) // 2) * h), abs((i * h) - ((w - i) // 2) * h)) for i in range(1, w)]

ans_wline = [max(abs((i * w) - ((w + 1) // 2) * (h - i)), abs((i * w) - (w // 2) * (h - i))) for i in range(1, h)]
ans_hline = [max(abs((i * h) - ((h + 1) // 2) * (w - i)), abs((i * h) - (h // 2) * (w - i))) for i in range(1, w)]

print(min(ans_wsplit + ans_hsplit + ans_wline + ans_hline))
A, B, C, K = map(int, input().split())
if K <= A:
  print(K)
else if A+B >= K:
  print(A)
else:
  print(A-(K-A-B))

### FIXED CODE ###

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

result = 0
t = min(A, K)
result += t
K -= t
t = min(B, K)
K -= t
t = min(C, K)
result -= t
print(result)
N, M = map(int, input())

if N == M:
    print('Yes')

else:
    print('No')

### FIXED CODE ###

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

if N == M:
    print('Yes')

else:
    print('No')
n,k= map(int,input().split())
Xl = list(map(int,input().split()))
from collections import Counter
Xdic = Counter(xl)
valuelist = sorted(list(Xdic.values), reverse=True)
print(sum(valuelist[k:]))

### FIXED CODE ###

n,k= map(int,input().split())
Xl = list(map(int,input().split()))
from collections import Counter
Xdic = Counter(Xl)
valuelist = sorted(list(Xdic.values()), reverse=True)
print(sum(valuelist[k:]))
#input
n, k = map(int, input().split())

#output
mod = pow(10, 9) + 7

def cmb(n, r):
    res = 1
    fac = 1
    for i in range(r):
        res *= (n-i)
        res %= mod
        fac *= (i+1)
        fac %= mod
    return res*pow(fac, mod-2, mod) % mod

if n <= k-1:
    print(cmb(2*n-1, n))
else:
    answer = 0
    for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, m) % mod

print(answer % mod)

### FIXED CODE ###

#input
n, k = map(int, input().split())

#output
mod = pow(10, 9) + 7

n_ = 4*10**5 + 5
fun = [1]*(n_+1)
for i in range(1,n_+1):
    fun[i] = fun[i-1]*i%mod
rev = [1]*(n_+1)
rev[n_] = pow(fun[n_],mod-2,mod)
for i in range(n_-1,0,-1):
    rev[i] = rev[i+1]*(i+1)%mod
def cmb(n,r):
    if n <= 0 or r < 0 or r > n: return 0
    return fun[n]*rev[r]%mod*rev[n-r]%mod

if n <= k-1:
    print(cmb(2*n-1, n))
else:
    answer = 0
    for m in range(k+1):
        answer += cmb(n, m)*cmb(n-1, m) % mod
        answer %= mod
    print(answer)
a,b=map(int, raw_input())
ans=Max([a+a-1,b+b-1,a+b])
print ans



### FIXED CODE ###

a,b=map(int, raw_input().split())
ans=max([a+a-1,b+b-1,a+b])
print ans
from collections import deque
n, q = map(int, input().split())
edges = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

counter = [0]*n
for i in range(q):
    p, x = map(int, input().split())
    counter[p-1] = x

visited = [0]*n


def dfs(parent):
    visited[parent] = 1
    for child in edges[parent]:
        if visited[child] == 1:
            continue
        else:
            counter[child] += counter[parent]
            dfs(child)

        
dfs(0)
print(counter)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
n, q = map(int, input().split())
edges = [[] for _ in range(n)]
for i in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)

counter = [0]*n
for i in range(q):
    p, x = map(int, input().split())
    counter[p-1] += x
visited = [0]*n


def dfs(parent):
    visited[parent] = 1
    for c in edges[parent]:
        if visited[c] == 1:
            continue
        else:
            counter[c] += counter[parent]
            dfs(c)


dfs(0)
print(*counter)
def main():
    input=sys.stdin.readline
    N,K=map(int,input().split())
    D=list(map(int,input().split()))
    L=[]
    for i in range(10):
        if i not in D:
            L.append(i)
    for p in L:
        if len(str(N))==1:
            if p>=N:
                print(p)
                return
        else:
            for q in L:
                if len(str(N))==2:
                    pay=p*10+q
                    if pay>=N:
                        print(pay)
                        return
                else:
                    for r in L:
                        if len(str(N))==3:
                            pay=p*100+q*10+r
                            if pay>=N:
                                print(pay)
                                return
                        else:
                            for s in L:
                                pay=p*1000+q*100+r*10+s
                                if pay>=N:
                                    print(pay)
                                    return
    if L[0]==0:
        print(L[1]*10**len(str(N)))
    else:
        print("".join([L[0] for _ in range(len(str(N)))]))
    return
            

if __name__=="__main__":
    main()

### FIXED CODE ###

import sys
def main():
    input=sys.stdin.readline
    N,K=map(int,input().split())
    D=list(map(int,input().split()))
    L=[]
    for i in range(10):
        if i not in D:
            L.append(i)
    for p in L:
        if len(str(N))==1:
            if p>=N:
                print(p)
                return
        else:
            for q in L:
                if len(str(N))==2:
                    pay=p*10+q
                    if pay>=N:
                        print(pay)
                        return
                else:
                    for r in L:
                        if len(str(N))==3:
                            pay=p*100+q*10+r
                            if pay>=N:
                                print(pay)
                                return
                        else:
                            for s in L:
                                pay=p*1000+q*100+r*10+s
                                if pay>=N:
                                    print(pay)
                                    return
    if L[0]==0:
        print(L[1]*10**len(str(N)))
    else:
        print("".join([str(L[0]) for _ in range(1+len(str(N)))]))
    return
            

if __name__=="__main__":
    main()
from math import factorial

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

x = 1000000007


def com(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))


for i in range(1, K + 1):
    v = com(N - K + 1, i) * com(K - 1, i - 1)
    print(int(v % x))


### FIXED CODE ###

from math import factorial

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

x = 1000000007

num = factorial(N - K + 1) * factorial(K - 1)

for i in range(1, K + 1):
    if N - K < i - 1:
        print(0)
    else:
        denom = factorial(i) * factorial(N - K + 1 - i) * factorial(i - 1) * factorial(K - i)
        v = num // denom

        print(v % x)
import math
a,b,c,d = map(int,input().split())
cd = (c*d) // (math.gcd(c,d))
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)

result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)

### FIXED CODE ###

import fractions
a,b,c,d = map(int,input().split())
cd = (c*d) // fractions.gcd(c,d)
c_sum = (b // c) - ((a-1) // c)
d_sum = (b // d) - ((a-1) // d)
cd_sum = (b // cd) - ((a-1) // cd)
result = b-a+1 -(c_sum+d_sum-cd_sum)
print(result)
#
# B - Ringo's Favorite Numbers

# B_Ringos_Favorite_Numbers.py

m = 100

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


if D == 0:
    print(N)
else:
    if D == 1:
        n = [i*100 for i in range(1, 100)]
    else:
        n = [i*10000 for i in range(1, 100)]
    print(n[N-1])


### FIXED CODE ###

# https://abc100.contest.atcoder.jp/tasks/abc100_b
# B - Ringos Favorite Numbers

# B_Ringos_Favorite_Numbers.py

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

if D == 0:
    #n = N
    #order_100 = -1
    #while n >= 1:
    #    n = n / 100
    #    order_100 += 1

    #if order_100 == 0:
    if N <= 99:
        print(N)
    else:
        print(101)

elif D == 1:
    if N <= 99:
        print(N*100)
    else:
        print(10100)
elif D == 2:
    if N <= 99:
        print(N*10000)
    else:
        print(1010000)
A,B,K = map(int,input().split())
ans = []
for i in range(A,A+K+1):
  if i <= B:
    ans.append(i)
for j in range(B,B-K,-1):
  if A.count(j) == 0 and j >= A:
    ans.append(j)
ans.sort()
for k in ans:
  print(k)

### FIXED CODE ###

A,B,K = map(int,input().split())
ans = []
for i in range(A,A+K):
  if i <= B:
    ans.append(i)
#print(ans)
for j in range(B,B-K,-1):
  #print("j",j)
  if j >= A+K:
    ans.append(j)
ans.sort()
for k in ans:
  print(k)
A = input()
B = input()

A=int(A)
B=int(B)

if  A*B % 2 == 0:
	print("Even")
else:
	print("Odd")

### FIXED CODE ###

N= input().split()

N[0]=int(N[0])
N[1]=int(N[1])

if  N[0]*N[1] % 2 == 0:
	print("Even")
else:
	print("Odd")
import sys

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(get_ints())
def input(): return sys.stdin.readline().strip().split()

r = int(input())
print(2*pi*r)

### FIXED CODE ###

import sys


from math import pi

def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(get_ints())
def input(): return sys.stdin.readline().strip()

r = int(input())
print(2*pi*r)
while True:
    l = map(int, raw_input().split())
    if l[0]==0 and l[1]==0 and l[2]==0: break
    n = l[0]+l[1]+l[2]
    s = [] #????¨????
    a = set(range(n)) #??????
    b = set() #?£????
    c = set() #??£???
    for i in range(input()):
        x, y, z, r = map(int, raw_input().split())
        x-=1;y-=1;z-=1;
        if r==0: s.append(set([x,y,z]))
        else:
            c.add(x);c.add(y);c.add(z);
    while True:
        f = True
        for lst in s:
            if len(lst & c) >=2:
                s.remove(lst)
                lst = lst - c
                if len(lst)>=1: b.add(lst.pop())
                f = False
        if f : break
    a = a - b; a = a - c;
    for i in range(n):
        if i in a: print 2
        elif i in b: print 0
        else: print 1

### FIXED CODE ###

while True:
    i,j,k = map(int, raw_input().split())
    if i==0 and j==0 and k==0: break
    n = i+j+k
    s = []
    a = set(range(n))
    b = set()
    c = set()
    for i in range(input()):
        x, y, z, r = map(int, raw_input().split())
        x-=1;y-=1;z-=1;
        if r==0: s.append(set([x,y,z]))
        else:
            c.add(x);c.add(y);c.add(z);
    while True:
        f = True
        for lst in s:
            if len(lst & c) >=2:
                s.remove(lst)
                lst = lst - c
                if len(lst)>=1: b.add(lst.pop())
                f = False
        if f : break
    a = a - b; a = a - c;
    for i in range(n):
        if i in a: print 2
        elif i in b: print 0
        else: print 1
a, b = input().split()

if a==H:
  print(b)
elif a==D:
  if b==H:
    print(D)
  elif b==D:
    print(H)

### FIXED CODE ###

a, b = map(str, input().split())

print('H' if a == b else 'D')
import sys
from collections import deque
input = sys.stdin.readline
h, w = map(int, input().split())
g = []
for i in range(h):
    g.append(input())

move = ((0, 1), (1, 0), (-1, 0), (0, -1))
ans = 0

for start in  [[i, j] for i in range(h) for j in range(w)]:
    if g[start[0]][start[1]] == "#":
        continue
    dp = [[0 for i in range(w)] for i in range(h)]
    pre = [-1, -1]
    cur = start
    cnt = 0
    queue = deque([[cur, pre, cnt]])
    while stack:
        cur, pre, cnt = queue.popleft()
        c_x, c_y = cur
        if not dp[c_x][c_y] or (dp[c_x][c_y] and dp[c_x][c_y] > cnt):
            dp[c_x][c_y] = cnt

            for x, y in move:
                next = [cur[0] + x, cur[1] + y]
                if next == start:
                    continue
                if next != pre and next[0] >= 0 and next[0] < h and next[1] >= 0 and next[1] < w:
                    queue.append([next, cur, cnt + 1])

    ans= max(max([dp[i][j] for i in range(h) for j in range(w)]), ans)


print(ans)


### FIXED CODE ###

import sys
from collections import deque
input = sys.stdin.readline
h, w = map(int, input().split())
g = []
for i in range(h):
    g.append(input())

move = ((0, 1), (1, 0), (-1, 0), (0, -1))
ans = 0

for start in  [[i, j] for i in range(h) for j in range(w)]:
    if g[start[0]][start[1]] == "#":
        continue
    dp = [[0 for i in range(w)] for i in range(h)]
    pre = [-1, -1]
    cur = start
    cnt = 0
    queue = deque([[cur, pre, cnt]])
    while queue:
        cur, pre, cnt = queue.popleft()
        c_x, c_y = cur
        if g[c_x][c_y] == '#':
          continue
        if not dp[c_x][c_y] or (dp[c_x][c_y] and dp[c_x][c_y] > cnt):
            dp[c_x][c_y] = cnt

            for x, y in move:
                next = [cur[0] + x, cur[1] + y]
                if next == start:
                    continue
                if next != pre and next[0] >= 0 and next[0] < h and next[1] >= 0 and next[1] < w:
                    queue.append([next, cur, cnt + 1])
    ans= max(max([dp[i][j] for i in range(h) for j in range(w)]), ans)


print(ans)