Harryxun/stf_run huggingface dataset:
n = list(map(int, input().split()))

for i in range(len(n)):
  if n[i] == 1:
    n[i] = 1
  elif n[i] == 7:
    n[i] = 10
  elif n[i] == 9:
    n[i] = 100
  elif n[i] == 4:
    n[i] = 1000
    
if sum(n) == 1111:
  print("YES")
else:
  print("NO")
"""

### FIXED CODE ###

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

for i in range(len(n)):
  if n[i] == 1:
    n[i] = 1
  elif n[i] == 7:
    n[i] = 10
  elif n[i] == 9:
    n[i] = 100
  elif n[i] == 4:
    n[i] = 1000
    
if sum(n) == 1111:
  print("YES")
else:
  print("NO")
a,b,c = map(int,input().split)

s = set([a,b,c)]

if len(s) == 2:
    print("Yes)
else:
    print("No")

### FIXED CODE ###

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

s = set([a,b,c])

if len(s) == 2:
  print("Yes")
else:
  print("No")
A = int(input())
B = int(input())

for i in range(1,4):
    if A * B * i % 2 == 1:
        print('Yes')
        break

print('No')

### FIXED CODE ###

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

if A * B % 2 == 1:
    print('Yes')
else:
 print('No')
from sys import stdin
def S(): return stdin.readline().rstrip()
def LI(): return list(map(int,stdin.readline().rstrip().split()))

def BFS(table,s,step,next,w,h):
    if table[h-1][w-1] != -2:
        return
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    nnext = []
    for i in range(len(next)):
        tmp = next[i]
        for j in range(4):
            nx = tmp[0] + dx[j]
            ny = tmp[1] + dy[j]
            if  nx<0  or ny<0 or w<=nx or h<=ny:
                continue
            else:
                if s[ny][nx]=='#':
                    continue
                if table[ny][nx]==-2 or step+1<table[ny][nx]:
                    table[ny][nx] = step+1
                    nnext.append([nx,ny])
    BFS(table,s,step+1,nnext,w,h)
    

if __name__=='__main__':
    tmp = LI()
    w,h = tmp.pop(),tmp.pop()
    s = [S() for _ in range(h)]
    table = [[-2]*w for _ in range(h)]
    table[0][0] = 0
    BFS(table,s,0,[[0,0]],w,h)
    step = table[h-1][w-1]
    c = 0
    for rep in s:
        c += rep.count('#')
    ans = w*h-step-c-1
    print(ans)

### FIXED CODE ###

from sys import stdin,setrecursionlimit
setrecursionlimit(10**6)
def S(): return stdin.readline().rstrip()
def LI(): return list(map(int,stdin.readline().rstrip().split()))

def BFS(table,s,step,next,w,h):
    if table[h-1][w-1] != -2:
        return
    dx = [1,0,-1,0]
    dy = [0,1,0,-1]
    nnext = []
    for rep in next:
        for j in range(4):
            nx = rep[0] + dx[j]
            ny = rep[1] + dy[j]
            if nx<0  or ny<0 or w<=nx or h<=ny:
                continue
            else:
                if s[ny][nx]=='#':
                    continue
                if table[ny][nx]==-2 or step+1<table[ny][nx]:
                    table[ny][nx] = step+1
                    nnext.append([nx,ny])
    if 0<len(nnext):
        BFS(table,s,step+1,nnext,w,h)

def main():
    tmp = LI()
    w,h = tmp.pop(),tmp.pop()
    s = [S() for _ in range(h)]
    table = [[-2]*w for _ in range(h)]
    BFS(table,s,0,[[0,0]],w,h)
    step = table[h-1][w-1]
    if step==-2:
        print(-1)
        exit()
    c = 0
    for rep in s:
        c += rep.count('#')
    ans = w*h-step-c-1
    print(ans)
    return

if __name__=='__main__':
    main()
text = ''
while True:
    s = input().lower()
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    #print(i+' : '+str(s.count(i)))
    sys.stdout.write("{0} : {1}\n".format(i, text.count(i)))

### FIXED CODE ###

text = ''
while True:
    try:
        s = input().lower()
    except EOFError:
        break
    if s == '':
        break
    text += s
for i in 'abcdefghijklmnopqrstuvwxyz':
    print(i+' : '+str(text.count(i)))
    #print("{0} : {1}".format(i, text.count(i)))
from collections import Counter
from itertools import permutations

N = int(input())
x, y = (
    zip(*(map(int, input().split()) for _ in range(N))) if N else
    ((), ())
)

# (p, q) = (x_i - x_j, y_i - y_j) を満たす組(i, j)の個数が最大となるように
# p, qを定めればよい
D = Counter(
    (x[i] - x[j], y[i] - y[j])
    for i, j in permutations(range(N), 2)
)
ans = N - max(D.values())

print(ans)


### FIXED CODE ###

N = int(input())
x, y = (
    zip(*(map(int, input().split()) for _ in range(N))) if N else
    ((), ())
)

class UnionFindTree:
    def __init__(self, n):
        self.p = [i for i in range(n + 1)]
        self.r = [0 for _ in range(n + 1)]

    def find(self, x):
        if self.p[x] != x:
            self.p[x] = self.find(self.p[x])
        return self.p[x]

    def union(self, x, y):
        px = self.find(x)
        py = self.find(y)
        if px != py:
            if self.r[px] < self.r[py]:
                self.p[px] = py
            else:
                self.p[py] = px
                if self.r[px] == self.r[py]:
                    self.r[px] += 1

    def same(self, x, y):
        return self.find(x) == self.find(y)


ans = 10**10

for i in range(N):
    for j in range(N):
        p, q = (x[i] - x[j], y[i] - y[j])
        uft = UnionFindTree(N)
        for u in range(N - 1):
            for v in range(u + 1, N):
                if (x[u] - x[v], y[u] - y[v]) == (p, q) or (x[u] - x[v], y[u] - y[v]) == (-p, -q):
                    uft.union(u, v)
        ans = min(ans, len({uft.find(z) for z in range(N)}))

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

import sys
sys.setrecursionlimit(100000)
nCr = {}
def cmb(n, r):
  if r == 0 or r == n: return 1
  if r == 1: return n
  if (n,r) in nCr: return nCr[(n,r)]
  nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
  return nCr[(n,r)]

if A==B:
  print(1)
else:
  for i in range(B):
    x=cmb((A-B+1),(i+1))*cmb((B-1),i)
    print(x%(10**9+7))


### FIXED CODE ###

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

import sys
sys.setrecursionlimit(100000)
nCr = {}
def cmb(n, r):
  if r == 0 or r == n: return 1
  if r == 1: return n
  if (n,r) in nCr: return nCr[(n,r)]
  nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
  return nCr[(n,r)]


for i in range(B):
  if i+1>A-B+1:
    print(0)
  else:
    x=cmb((A-B+1),(i+1))*cmb((B-1),i)
    print(x%(10**9+7))
#import math

while True:
    w = []
    k = []
    for i in range(10):
        w.append(int(input()))
    for i in range(10):
        k.append(int(input()))
    w.sort()
    k.sort()
    print(sum(w[-3:]),sum(k[-3:]))


### FIXED CODE ###

w = [int(input()) for i in range(10)]
k = [int(input()) for i in range(10)]
w.sort()
k.sort()
print(sum(w[-3:]),sum(k[-3:]))
from decimal import *
a, b = map(float, input().split())
 
num = Decimal('a') * Decimal('b')
print(int(num))

### FIXED CODE ###

from decimal import *
a, b = map(str, input().split())
 
num = (Decimal(a) * Decimal(b)).quantize(Decimal('1'), rounding=ROUND_DOWN)
print(num)
#import sys
#input=lambda: sys.stdin.readline().strip()

N = int(input())

S = [input() for _ in range(N)]
S_p = []
S_n = []

for i in range(N):
  end = 0
  mim = 0
  for c in input():
    if c == "(":
      end += 1
    else :
      end -= 1
    mim = min(mim,end)
  
  if end >= 0:
    S_p.append([mim, end])
  else:
    S_n.append([end-mim, end])
  
S_p.sort(reverse=True)
S_n.sort(reverse=True)
#print(S_p)
#print(S_n)

check = 0
flag = True
for i in range(len(S_p)):
  if check + S_p[i][0] >= 0:
    check += S_p[i][1]
  else:
    flag = False
    break
  #print(check)
  
for i in range(len(S_n)):
  if check + S_n[i][1] - S_n[i][0] >= 0:
    check += S_n[i][1]
  else:
    flag = False
    break
  #print(check)
  
if check == 0 and flag:
  flag = True
else:
  flag = False

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

### FIXED CODE ###

import sys
input=lambda: sys.stdin.readline().rstrip()

N = int(input())

S_p = []
S_n = []

for i in range(N):
  end = 0
  mim = 0
  for c in input():
    if c == "(":
      end += 1
    else :
      end -= 1
    mim = min(mim,end)
  
  if end >= 0:
    S_p.append([mim, end])
  else:
    S_n.append([end-mim, end])
  
S_p.sort(reverse=True)
S_n.sort(reverse=True)
#print(S_p)
#print(S_n)

check = 0
flag = True
for i in range(len(S_p)):
  if check + S_p[i][0] >= 0:
    check += S_p[i][1]
  else:
    flag = False
    break
  #print(check)
  
for i in range(len(S_n)):
  if check + S_n[i][1] - S_n[i][0] >= 0:
    check += S_n[i][1]
  else:
    flag = False
    break
  #print(check)
  
if check == 0 and flag:
  flag = True
else:
  flag = False

print("Yes" if flag else "No")
t = input()
s = list(t)
k = int(input())

ans = 0

s = s+s
for i in range(1,len(s)):
  if s[i-1] == s[i]:
    s[i] = "0"
    if i>=len(s)//2:
      ans += k-1
    else:
      ans += 1
      
if len(set(list(t))) == 1 and len(t)%2 == 1:
  ans = len(t) * (k//2) + (k%2==1)*(k//2)
  ans = 1/0
print(ans)

### FIXED CODE ###

t = input()
s = list(t)
k = int(input())

ans = 0

s = s+s
for i in range(1,len(s)):
  if s[i-1] == s[i]:
    s[i] = "0"
    if i>=len(s)//2:
      ans += k-1
    else:
      ans += 1
      
if len(set(list(t))) == 1 and len(t)%2 == 1:
  ans = len(t) * (k//2) + (k%2==1)*(len(t)//2)
print(ans)
X=int(input())
Y=int(input())
Z=int(input())
print(Z,X,Y)

### FIXED CODE ###

X,Y,Z = map(int, input().split())
print(Z,X,Y)
n = int(input())
s = input()

ans = n
cnt_w = s.count('.')
cnt_k = 0
if cnt == n or cnt == 0:
    ans = 0
    print(ans)
else:
    for i in range(n):
        if s[i] == '.':
            cnt_w -= 1
        else:
            cnt_k += 1
        if ans > cnt_w + cnt_k:
            ans = cnt_w + cnt_k
    print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
s = list(input())
res = 10**9

cta = 0
ctb = 0
a = [0]*n
b = [0]*n
for i in range(n):
    if s[i] == '.':
        cta += 1
    else:
        ctb += 1
    a[i] = cta
    b[i] = ctb
for i in range(n):
    res = min(res,b[i]+a[-1]-a[i])
res = min(res,a[-1],b[-1])
print(res)
S = input()
n = 0
if S[1] not in S[0]:
  n += 1
if S[2] not in S[0,1]:
  n += 1
if S[3] not in S[0,2]:
  n += 1
if n == 2:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = input()
if ((S[0] == S[1]) and (S[0] !=S[2]) and (S[2] == S[3]))or((S[0] != S[1]) and (S[0] ==S[2]) and (S[1] == S[3]))or((S[0] != S[1]) and (S[1] == S[2]) and (S[0] == S[3])):
  print("Yes")
else:
  print("No")
= input()[::-1]

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    counts[num] += 1
    d *= 10

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2
    
print(ans)

### FIXED CODE ###

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
N=int(input())
S=[input() for c in range(N)]
ans=0
xa=0;bx=0;bxa=0;
for s in S:
  ans+=s.count("AB")
  xa+=(s[0]!="B"&&S[-1]=="A")
  bx+=(s[0]=="B"&&S[-1]!="A")
  bxa+=(s[0]=="B"&&S[-1]=="A")
print(ans+(bxa-1)+min(xa,bx)+(xa!=bx&&bxa>0))




### FIXED CODE ###

N=int(input())
S=[input() for i in range(N)]
BXA=0;XA=0;BX=0;ans=0;
for s in S:
  ans+=s.count("AB")
  if(s[0]=='B' and s[-1]=='A'):
    BXA+=1
  elif(s[0]=='B'):
    BX+=1
  elif(s[-1]=='A'):
    XA+=1
#print(ans,min([XA,BX]))
if min([XA,BX])>0:
  ans+=min([XA,BX])+BXA
elif max([XA,BX])>0:
  ans+=BXA
else:
  ans+=max([BXA-1,0])
print(ans)
import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b,c,d=mp()
s=input()
if s[a-1]=="#" or s[b-1]=="#" or s[c-1]=="#" or s[d-1]=="#":
    print("No")
    exit()
for i in range(min(a,b)-1,max(c,d)):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        exit()
if d<c:
    ch=False
    for i in range(b-1,d):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ch=True
    if ch:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    print("Yes")

### FIXED CODE ###

import sys
from collections import Counter
from collections import deque
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,a,b,c,d=mp()
s=input()
if s[a-1]=="#" or s[b-1]=="#" or s[c-1]=="#" or s[d-1]=="#":
    print("No")
    exit()
for i in range(min(a,b)-1,max(c,d)):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        exit()
if d<c:
    ch=False
    for i in range(b-2,d-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ch=True
    if ch:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    print("Yes")
a,b=map(int,input().split())
if a>b:
    print("GREATER")
elif a<b:
    print("EQUAL")
else:
    print("LESS")
    

### FIXED CODE ###

a=int(input())
b=int(input())
if a>b:
    print("GREATER")
elif a<b:
    print("LESS")
else:
    print("EQUAL")
n=int(input())
s=list(input())
n=len(s)
if s[1]=='.'
  li=[]
  if s[0]=='.':
    a=0
    s.insert(0,"あ")
    for i in range (1,n+1):
      if s[i]==s[i-1]:
        a=a+1
      else:
        li.append(a)
        a=1
    li.append(a)
  else:
    a=1
    for i in range (0,n-1):
      if s[i+1]==s[i]:
        a=a+1
      else:
        li.append(a)
        a=1
    if s[n-2]==s[n-1]:
      a=a+1
      li.append(a)
    else:
      li.append(a)
  if s[0]=="あ":
    s.pop(0)
  if s[n-1]==".":
    li.append(0)
  len_li=len(li)
  import math
  t=math.floor(len_li/2)+1
  l=[]
  m=0
  for j in range (0,t-1):
    m=m+li[2*j+1]
  x=0
  y=0
  for k in range (0,t):
    l.append(m+y-x)
    y=y+li[2*k]
    if k!=t-1:
      x=x+li[2*k+1]
  l.sort()
  print(l[0])
else:
  print(1)

### FIXED CODE ###

a,b,c=map(int,input().split())
if a<=c and c<=b:
  print("Yes")
elif a>=c and c>=b:
  print("Yes")
else:
  print("No")
def count_max(road):
    num = len(road)
    used = [False for i in range(num)]
    res = 0
    for i in range(num):
        if used[i]:
            continue
        used[i] = True
        line = road[i][:]
        for j in line:
            used[j] = True
        count = 1
        while len(line):
            now_point = line.pop()
            count += 1
            next = [j for j in road[now_point] if not used[j]]
            for j in next:
                used[j] = True
            line += next
        res += count * (count - 1) // 2
    return res


def getparent(parent, place):
    my_parent = parent[place]
    if my_parent == place:
        return place
    parent[place] = getparent(parent, my_parent)
    return parent[place]

def main():
    ans = []
    n, m = list(map(int, input().split()))
    broad = [[] for i in range(n)]
    b_pair = []
    parent = [i for i in range(n)]
    parent_sum = [1 for i in range(n)]
    for i in range(m):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        broad[a].append(b)
        broad[b].append(a)
        b_pair.append((a, b))
    sum_count = count_max(broad)
    ans.append(sum_count)
    b_pair.reverse()
    b_pair.pop()
    for p, q in b_pair:
        np, nq = getparent(parent, p), getparent(parent, q)
        if np != nq:
            sum_count -= parent_sum[np] * parent_sum[nq]
            parent_sum[np] += parent_sum[nq]
            parent[nq] = np
        ans.append(sum_count)
    ans.reverse()
    for i in ans:
        print(i)


if __name__ == "__main__":
    main()



### FIXED CODE ###

def getparent(parent, place):
    childrens = [place]
    while place != parent[place]:
        place = parent[place]
        childrens.append(place)
    for i in childrens:
        parent[i] = place
    return place


def main():
    ans = []
    n, m = list(map(int, input().split()))
    pairs = []
    parent = [i for i in range(n)]
    parent_sum = [1 for _ in range(n)]
    for i in range(m):
        a, b = list(map(int, input().split()))
        pairs.append((a - 1, b - 1))
    sum_count = n * (n - 1) // 2
    ans.append(sum_count)
    for p, q in reversed(pairs[1:]):
        np, nq = getparent(parent, p), getparent(parent, q)
        if np != nq:
            sum_count -= parent_sum[np] * parent_sum[nq]
            parent_sum[np] += parent_sum[nq]
            parent[nq] = np
        ans.append(sum_count)
    ans.reverse()
    for i in ans:
        print(i)


if __name__ == "__main__":
    main()
line = input()
sum = 0
for i in range(len(line)):
  sum = sum + int(line[0])
 print(sum)

### FIXED CODE ###

N=int(input())
if N % 9 == 0:
    print("Yes")
else:
    print("No")
sum = 0
for num in a:
    sum = sum | num

ans = 0
for t in range(200):
    if sum & 1 == 0:
        sum = sum >> 1
        ans += 1
    else:
        break
print(ans)

### FIXED CODE ###

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

def exec(a, n):
    if len([x for x in a if x%2 == 0]) == n:
        return [int(x/2) for x in a]
    return []

i = 0
while True:
    t = exec(a, n)
    if len(t):
        i += 1
        a = t
    else:
        break

print(i)
import sys
input = sys.stdin.readline
import math
def print_ans(A, B):
    """Test Case
    >>> print_ans(2, 3)
    6
    >>> print_ans(123, 456)
    18696
    >>> print_ans(100000, 99999)
    9999900000
    """
    print(math.ceil(A * B / math.gcd(A, B)))
if __name__ == '__main__':
    # test
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)

### FIXED CODE ###

import sys
input = sys.stdin.readline
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def print_ans(A, B):
    """Test Case
    >>> print_ans(2, 3)
    6
    >>> print_ans(123, 456)
    18696
    >>> print_ans(100000, 99999)
    9999900000
    """
    print(A * B // gcd(A, B))
if __name__ == '__main__':
    # test
    A, B = map(int, input().rstrip().split())
    print_ans(A, B)
A,P = map(int(input(),split())

apple_cut = A * 3

apple_pie = (apple_cut + P) /2
                 
print(apple_pie)

### FIXED CODE ###

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

apple_cut = A * 3

apple_pie = (apple_cut + P) /2
                 
print(int(apple_pie))
#!/usr/bin/env python3
N, M = map(int, input().split())
x = [-1] * N
used = [False] * N
G = [[] for _ in range(N)]

def dfs(s):
    for t, d in G[s]:
        if not used[t]:
            used[t] = True
            x[t] = x[s] + d
            dfs(t)
        else:
            if x[t] - x[s] != d:
                return False
    return True

ans = True
for i in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    G[L].append([R, D])
    G[R].append([L, -D])
for i in range(N):
    if not used[i]:
        used[i] = True
        x[i] = 0
        if not dfs(i):
            ans = False
            break
print(('No', 'Yes')[ans])


### FIXED CODE ###

#!/usr/bin/env python3
import sys
sys.setrecursionlimit(200002)

def dfs(s):
    for t, d in G[s]:
        if x[t] is None:
            x[t] = x[s] + d
            if not dfs(t):
                return False
        else:
            if x[t] - x[s] != d:
                return False
    return True

N, M = map(int, input().split())
x = [None] * N
G = [[] for _ in range(N)]
for i in range(M):
    L, R, D = map(int, input().split())
    L -= 1
    R -= 1
    G[L].append([R, D])
    G[R].append([L, -D])
ans = True
for i in range(N):
    if x[i] is None:
        x[i] = 0
        if not dfs(i):
            ans = False
print(('No', 'Yes')[ans])
a = list(input())
b = list(input())

ans = []

for i in range(len(a)):
    ans.append(a[i])
    ans.append(b[i])
print(''.join(ans))

### FIXED CODE ###

s1=input()

s2=input()

ans = []

for i in range(len(s1)+len(s2)):
    if i%2==0:
        ans.append(s1[i//2])
    else:
        ans.append(s2[i//2])

print(''.join(map(str,ans)))
import math
import sys
input = sys.stdin.readline

def main():
    x, y = map(int, input().split())
    if (2 * y - x) % 3 == 0:
        x_c = (2 * y - x) // 3
        y_c = y - 2 * x_c
        print(x_c, y_c)
        if x_c == 0 or y_c == 0:
            print(1)
        else:
            f = math.factorial
            print(f(x_c+y_c)/(f(x_c) * f(y_c)))
    else:
        print(0)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
import sys
input = sys.stdin.readline

def main():
    mod = 10 ** 9 + 7
    x, y = map(int, input().split())
    if (2 * y - x) % 3 != 0:
        print(0)
        return None

    n = (2 * y - x) // 3
    m = y - 2 * n

    if n < 0 or m < 0:
        print(0)
    elif n == 0 and m == 0:
        print(0)
    elif n == 0 or m == 0:
        print(1)
    else:
        s = n + m + 1
        f = [1] * s

        for i in range(1, s):
            f[i] = f[i-1] * i % mod

        ans = f[n+m]
        ans = ans * modinv(f[n]) % mod
        ans = ans * modinv(f[m]) % mod
        print(ans)

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

if __name__ == '__main__':
    main()
n = int(input())
for i in range(n):
	line = list(map(float,input().split()))
	AB = (line[3] - line[1]) / (line[2] - line[0])
	CD = (line[7] - line[5]) / (line[6] - line[4])
	if round(AB - CD,8) == 0:
		print("YES")
	else:
		print("NO")

### FIXED CODE ###

from fractions import Fraction

def sroap(x1,y1,x2,y2):
	if x2 - x1 == 0:
		return float("inf")
	else:
		return Fraction(y2 - y1,x2 - x1)
		
N = int(input())
for n in range(N):
	Ax,Ay,Bx,By,Cx,Cy,Dx,Dy = map(lambda x: round(x * 10 ** 5),(map(float,input().split())))
	if sroap(Ax,Ay,Bx,By) == sroap(Cx,Cy,Dx,Dy):
		print("YES")
	else:
		print("NO")
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
s=input()
t=input()
ans=""
for i in range(n):
    ans+=s[i]
    ans+=t[i]
print(ans)

### FIXED CODE ###

import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
s,t=input().split()
ans=""
for i in range(n):
    ans+=s[i]
    ans+=t[i]
print(ans)
from sys import stdin
stdin = open('./input.txt')
l = stdin.readline().rstrip()
month_possible = ['01','02','03','04','05','06','07','08','09','10','11','12']
year_possible = ['00']

fo = ''.join(l[0:2])
la = ''.join(l[2:])

if 0 < int(fo) <= 12:
    if 0 < int(la) <= 12:
        print("AMBIGUOUS")
    elif 0 <= int(la) < 100:
        print("MMYY")
    else:
        print("NA")
else:
    if 0 < int(la) <= 12:
        print("YYMM")
    else:
        print("NA")


### FIXED CODE ###

from sys import stdin
# stdin = open('./input.txt')
l = stdin.readline().rstrip()
month_possible = ['01','02','03','04','05','06','07','08','09','10','11','12']
year_possible = ['00']

fo = ''.join(l[0:2])
la = ''.join(l[2:])

if 0 < int(fo) <= 12:
    if 0 < int(la) <= 12:
        print("AMBIGUOUS")
    elif 0 <= int(la) < 100:
        print("MMYY")
    else:
        print("NA")
else:
    if 0 < int(la) <= 12:
        print("YYMM")
    else:
        print("NA")
a = int(input())
b = int(input())
c = int(input())

print(h * (a+b) // 2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())
 
print(h * (a+b) // 2)
a, b, k = map(int, input().split())
l = list(range(a, b+1))
for i in l[:]:
    if a+k-1 < i < b-k+1:
        l.remove(i)

for i in range(len(l)):
    print(l[i])

### FIXED CODE ###

a, b, k = map(int, input().split())
la = list(range(a, a+k))
lb = list(range(b-k+1, b+1))
set = sorted(set(la+lb))

for i in set:
    if a <= i <= b:
        print(i)
import sys,math

inputs = list()

for n in sys.stdin:
    inputs.append(list(map(int,n.split())))

for n in inputs:
    print(math.floor(math.log10(n[0]*n[1]))+1)

### FIXED CODE ###

import sys

for line in sys.stdin:
    a, b = map(int, line.split())
    print(len(str(a + b)))
N = int(input())

def standard_string(N, st):
  if st = "":
    standard_string(N, "a")
  if len(st) == N:
    print(st)
    return 
  for i in range(97, ord(st[-1])+ 1):
    st += char(i)
    standard_string(N, st)
    st = st[:-1]
standard_string(N, "")

### FIXED CODE ###

N = int(input())

def standard_string(N, st):
    if len(st) == N:
        print(st)
    elif st == "":
        standard_string(N, "a")
    else:
        for i in range(97, ord(max(st))+ 2):
            st += chr(i)
            standard_string(N, st)
            st = st[:-1]
standard_string(N, "")
n = int(input())
a = []
for i in range(n):
  s, p = map(int, input().split())
  a.append([s,-p,i])
a.sort()
for i in a:
  print(i[-1])

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
  s, p = input().split()
  a.append([s,-int(p),i])
a.sort()
for i in a:
  print(i[-1]+1)