Problem:


Score : 200 points

Problem Statement

There are four towns, numbered 1,2,3 and 4.
Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally.
No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roads.

Determine if we can visit all the towns by traversing each of the roads exactly once.

Constraints

1 \leq a_i,b_i \leq 4(1\leq i\leq 3)

a_i and b_i are different. (1\leq i\leq 3)

No two roads connect the same pair of towns.

Any town can be reached from any other town using the roads.

Input

Input is given from Standard Input in the following format:

a_1 b_1
a_2 b_2
a_3 b_3

Output

If we can visit all the towns by traversing each of the roads exactly once, print YES; otherwise, print NO.

Sample Input 1

4 2
1 3
2 3

Sample Output 1

YES

We can visit all the towns in the order 1,3,2,4.

Sample Input 2

3 2
2 4
1 2

Sample Output 2

NO

Sample Input 3

2 1
3 2
4 3

Sample Output 3

YES



Sample input:
4 2
1 3
2 3


Sample output:
YES

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**8) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

cnt = [0]*4
for _ in range(3):
    a,b = li_()
    cnt[a] += 1
    cnt[b] += 1
    
if max(cnt) == 2:
    print('YES')
else:
    print('NO')

Submission status: Accepted

Solution code:
A = [0]*5
for i in range(3):
    a, b = map(int, input().split())
    A[a]+=1
    A[b]+=1
if max(A)==3:
    print("NO")
else:
    print("YES")

Submission status: Accepted

Solution code:
a1 , b1 = map(int,input().split())
a2 , b2 = map(int,input().split())
a3 , b3 = map(int,input().split())
l = [0] * 4
l[a1-1]+=1
l[a2-1]+=1
l[a3-1]+=1
l[b1-1]+=1
l[b2-1]+=1
l[b3-1]+=1
l = sorted(l)
if l == [1,1,2,2]:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
#どの 2 つの街の間も、道を何本か通ることで行き来することができる
cnts=[0]*4
for i in range(3):
    ai,bi=map(int, input().split())
    ai-=1;bi-=1
    cnts[ai]+=1;cnts[bi]+=1
for i in range(4):
    if cnts>2:
        print("NO")
        exit()
print("YES")

Submission status: Runtime Error

Solution code:
c = [0] * 4
for i in range(3):
    in1, in2 = cin()
    c[in1 - 1] += 1
    c[in2 - 1] += 1
c = sorted(c)
if c == [1, 1, 2, 2]:  print("YES")
else:  print("NO")

Submission status: Runtime Error

Solution code:
print('YNEOS'[len({*map(int,input().split())for i in range(3)})!=4::2])

Submission status: Runtime Error

Solution code:
G = [0] * 4
for i in range(3):
    a, b = mii()
    a -= 1
    b -= 1
    G[a] += 1
    G[b] += 1

for i in range(4):
    if G[i] == 3:
        print('NO')
        exit()

print('YES')

Submission status: Runtime Error

Solution code:
l = []
for i in range(3):
  a,b = map(int, input().split())
  l.append(a)
  l.append(b)

for i in range(1,5):
  cnt=0
  for itm in l:
    if i==l:
      cnt+=1
  if cnt>=3:
    print("NO")
 	exit()
print("YES")

Submission status: Runtime Error

Solution code:
L = [map(int,input().split()) for _ in range(3)]
L.sort()
M = []
a = L.count('1')
b = L.count('2')
c = L.count('3')
d = L.count('4')
M.append(a)
M.append(b)
M.append(c)
M.append(d)
M.sort()
if M == [1,1,2,2]:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
from collections import*
print("YNEOS"[Counter(open(0).read().split()).most_comon()[0][1]!=3::2])

Submission status: Runtime Error

Solution code:
def pin(type=int):
  return map(type,input().split())
counter = [0]*4
for i in range(3):
  a,b=pin()
  counter[a]+=1
  counter[b]+=1
ans=1
for j in counter:
  if j>3 or j<1:
    ans=0
print(["NO","YES"][ans])

Submission status: Runtime Error

Solution code:
lista = []
for i in range(3):
  a,b = map(int,input().split()))
  lista.append(a)
  lista.append(b)
l1 = 0
l2 = 0
l3 = 0
l4 = 0
for j in lista:
  if j == 1:
    l1 += 1
  if j == 2:
    l2 += 1
  if j == 3:
    l3 += 1
  if j == 4:
    l4 += 1
c = l1%2 + l2%2 + l3%2 + l4%2
if c%2 == 0:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
d=[0 for in range(4)]
for i in range(3):
  a,b=map(int,input().split())
  d[a-1]+=1
  d[b-1]+=1
print(("NO","YES")[d.count(1)==2 and d.count(2)==2])

Submission status: Runtime Error

Solution code:
ans=[0]*4

for i in range(3):
    a,b=map(int,input())
    ans[a-1]+=1
    ans[b-1]+=1

f1=0
f2=0
for i in range(4):
    if ans[i]==1:
        f1+=1
    if ans[i]==2:
        f2+=1
if f1==2 and f2==2:
    print('YES')
else:
    print('NO')

Submission status: Runtime Error

Solution code:
ans = [0, 0, 0, 0]
for i in range(3):
	x = list(map(int, input().split()))
	for xi in x:
		ans[xi] += 1
if sorted(ans) == [1, 1, 2, 2]:
	print("YES")
else:
	print("NO")

Submission status: Runtime Error

Solution code:
from collections import Counter
cnt = Counter()
for i in range(3):
  cnt.update([int(item) for item in input().split()])
a = cnt.values()
a.sort()
if a[0] == 1 and a[1] == 1 and a[2] == 2 and a[3] == 2:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
for i in range(3):
  L=lsit(map(int,input().split()))
A=[]
for i in L:
  A.spprnd(i)
if len(set(A))==4 and len(A)-len(set(A))==2:
  print("Yes")
else:
  print("No")

Submission status: Runtime Error

Solution code:
a = [0]*5
for i in range(3):
  x,y = map(int,input().split())
  a[x] += 1
  a[y] += 1
if sorted(a) = [0,1,1,2,2]:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
a = [0]*4
for i in range(3):
  x,y = map(int,input().split())
  a[x] += 1
  a[y] += 1
if sorted(a) = [1,1,2,2]:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
h,w=map(int,input().split())
l=[]
n=0
m=0
cou=0
for i in range(h):
    x=input()
    if x==("."*w):
        cou+=1
        continue
    l.append(list(x))
for i in range(w):
    k=0
    for j in range(h-cou-1):
        if l[j][i]=="#":
            break
        else:
            k+=1
    if k==h-cou:
        for d in range(h-cou):
            del l[d][i]
for i in range(h-cou):
    l[i]="".join(l[i])
    print(l[i])

Submission status: Runtime Error

Solution code:
edges = [map(int, input().split()) for _ in range(3)]

flattened = [i for sub in edges for i in sub]
cont = sorted([flattened.count(i) for i in range(4)])
ans = 'YES' if cont = [1,1,2,2] else 'NO'

Submission status: Runtime Error

Solution code:
def solution(edges):
    num_of_neighbor = {}
    for e in edges:
        if e[0] in num_of_neighbor:
            num_of_neighbor[e[0]] += 1
        else:
            num_of_neighbor[e[0]] = 1
        if e[1] in num_of_neighbor:
            num_of_neighbor[e[1]] += 1
        else:
            num_of_neighbor[e[1]] = 1
    n_2 = 0
    n_1 = 0
    for n in num_of_neighbor:
        if num_of_neighbor[n] == 2:
            n_2 += 1
        elif num_of_neighbor[n] == 1:
            n_1 += 1

        if n_2 == 2 and n_1 == 2:
            return 'YES'
        else:
            return 'NO'




e1 = [int(s) for s in input().split(' ')]
e2 = [int(s) for s in input().split(' ')]
e3 = [int(s) for s in input().split(' ')]
edges = [e1, e2, e3]
print(solution(table))

Submission status: Runtime Error

Solution code:
def solution(path1, path2, path3):
    counts = [0, 0, 0, 0]
    paths = [path1, path2, path3]
    for path in paths:
        counts[path[0] - 1] += 1
        counts[path[1] - 1] += 1

    countsOfCounts = [0, 0]
    for count in counts:
        if count == 1:
            if countsOfCounts[0] == 2:
                return "NO"
            countsOfCounts[0] += 1
        elif count == 2:
            if countsOfCounts[1] == 2:
                return "NO"
            countsOfCounts[1] += 1
        else:
            return "NO"
    return "YES"


s1, s2, s3 = input().split('\n')
path1 = [int(s) for s in s1.split(' ')]
path2 = [int(s) for s in s2.split(' ')]
path3 = [int(s) for s in s3.split(' ')]

print(solution(path1, path2, path3))

Submission status: Runtime Error

Solution code:
def solution(path1, path2, path3):
    counts = [0, 0, 0, 0]
    paths = [path1, path2, path3]
    for path in paths:
        counts[path[0] - 1] += 1
        counts[path[1] - 1] += 1

    countsOfCounts = [0, 0]
    for count in counts:
        if count == 1:
            if countsOfCounts[0] == 2:
                return "NO"
            countsOfCounts[0] += 1
        elif count == 2:
            if countsOfCounts[1] == 2:
                return "NO"
            countsOfCounts[1] += 1
        else:
            return "NO"
    return "YES"


if __name__ == "__main__":
    s1, s2, s3 = input().split('\n')
    path1 = [int(s) for s in s1.split(' ')]
    path2 = [int(s) for s in s2.split(' ')]
    path3 = [int(s) for s in s3.split(' ')]

    print(solution(path1, path2, path3))

Submission status: Runtime Error

Solution code:
def solution(path1, path2, path3):
    counts = [0, 0, 0, 0]
    paths = [path1, path2, path3]
    for path in paths:
        counts[path[0]] += 1
        counts[path[1]] += 1

    countsOfCounts = [0, 0]
    for count in counts:
        if count == 1:
            if countsOfCounts[0] == 2:
                return "NO"
            countsOfCounts[0] += 1
        elif count == 2:
            if countsOfCounts[1] == 2:
                return "NO"
            countsOfCounts[1] += 1
        else:
            return "NO"
    return "YES"


s1, s2, s3 = input().split('\n')
path1 = [int(s) for s in s1.split(' ')]
path2 = [int(s) for s in s2.split(' ')]
path3 = [int(s) for s in s3.split(' ')]

print(solution(path1, path2, path3))

Submission status: Runtime Error

Solution code:
def solution(path1, path2, path3):
    counts = [0, 0, 0, 0]
    paths = [path1, path2, path3]
    for path in paths:
        counts[path[0]] += 1
        counts[path[1]] += 1

    countsOfCounts = [0, 0]
    for count in counts:
        if count == 1:
            if countsOfCounts[0] == 2:
                return "NO"
            countsOfCounts[0] += 1
        elif count == 2:
            if countsOfCounts[1] == 2:
                return "NO"
            countsOfCounts[1] += 1
        else:
            return "NO"
    return "YES"


path1 = [int(s) for s in input().split(' ')]
path2 = [int(s) for s in input().split(' ')]
path3 = [int(s) for s in input().split(' ')]

print(solution(path1, path2, path3))

Submission status: Runtime Error

Solution code:
import numpy as np
a, b = [], []
for i in range(3):
  a[i], b[i] = np.array(input()split())

Submission status: Runtime Error

Solution code:
 = [[0 for x in range(1)]for y in range(3)]
one_count = 0
two_count = 0
three_count = 0
four_count = 0
for i in range(3):
     A[i] = [int(x) for x in input().split()]

     if(A[i][0]==1 or A[i][1]==1):
         one_count += 1
     if(A[i][0]==2 or A[i][1]==2):
         two_count += 1
     if(A[i][0]==3 or A[i][1]==3):
         three_count += 1
     if(A[i][0]==4 or A[i][1]==4):
         four_count += 1

if(one_count >= 3 or two_count >= 3 or three_count >= 3 or four_count >= 3):
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
 = [[0 for x in range(1)]for y in range(3)]
one_count = 0
two_count = 0
three_count = 0
four_count = 0
for i in range(3):
     A[i] = [int(x) for x in input().split()]

     if(A[i][0]==1 or A[i][1]==1):
         one_count += 1
     if(A[i][0]==2 or A[i][1]==2):
         two_count += 1
     if(A[i][0]==3 or A[i][1]==3):
         three_count += 1
     if(A[i][0]==1 or A[i][1]==1):
         four_count += 1

if(one_count >= 3 or two_count >= 3 or three_count >= 3 or four_count >= 3):
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
'''input

'''
import time
import math
l = [[0] for i in range(5)]
for i in range(4):
	a, b = map(int, input().strip().split())
	l[a].append(b)
	l[b].append(a)
for i in range(1, 5):
	if(len(l[i]) > 2):
		flag = 1
		break
print("YES" if flag else "NO")

Submission status: Runtime Error

Solution code:
l=[]
b=[(0,0)]
for  i in range(3):
    d,s=map(int,input().split())
    l.append((d,s))
c=l[0][1]
b[0]=l[0]
q=[]
for i in range(1,len(l)):
    if l[i][0]==c or l[i][1]==c:
        if c==l[i][0]:
            c=l[i][1]
            b.append(c)
        else:
            c=l[i][0]
            b.append(c)
    else:
        q.append(l[i])
if len(b)!=3:
    if q[0][1]==c:
        b.append(q[0][0])
    elif q[0][0]==c:
        b.append(q[0][1])
    else:
        b.append(89)
        
f=b[0][1]+b[0][0]+b[1]+b[2]
if f==10:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
data = []
for i in range(3):
    data.append(list(map(int, input().split())))
data = sum(data, [])

for i in data:
    result[i-1]+=1
if 3 in result:
    print("NO")
else:
    print("YES")

Submission status: Runtime Error

Solution code:
c=[]
for i in range(3):
  a,b=map(int,input().split())
  c.append(a)
  c.append(b)
c=sorted(c)
if c[5]=c[3]:
  print('No')
else:
  print('Yes')

Submission status: Runtime Error

Solution code:

from collections import *
import sys


def is_all_tarverse(start, mem, town_mem):

    if len(town_mem) == len(paths):
        return True

    for nxt in paths[start]:
        edge = frozenset((start, nxt))
        if edge in mem: continue
        if is_all_tarverse(nxt, mem | {edge}, town_mem | {nxt}):
            return True

    return False


paths = defaultdict(set)

a = input()
while a:
    st, dt = [int(x) for x in a.split()]
    paths[st].add(dt)
    paths[dt].add(st)
    a = input()

for start in paths:
    if is_all_tarverse(start, set(), {start}):
        print('YES')
        sys.exit()

print('NO')

Submission status: Runtime Error

Solution code:
s = []
s.append([input().split() for i in range(3)])
print(len(set(s)))
if len(set(s)) == 4:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
print('YES'if __import__('collections').Counter(map(int,open(0).read().split())).most_common[0][1]<3 else'NO')

Submission status: Runtime Error

Solution code:
li = [stdin.readline().rstrip().split() for _ in range(n)]
li = sum(li,[])
while True:
    n = 1
    if li.count(n) == 4:
        print("NO")
        break
    elif li.count(n) == 0:
        print("NO")
        break
    elif n == 4:
        print("YES")
        break
    else:
        n += 1

Submission status: Runtime Error

Solution code:
a = []
b = []
cnt = {}

for i in range(3):
    a.append(int(input()))
    b.append(int(input()))
    cnt.setdefault(a[i], 0)
    cnt.setdefault(b[i], 0)
    cnt[a[i]] += 1
    cnt[b[i]] += 1

for v in cnt.values():
    max_value = v
    if max_value <= v:
        max_value = v

if len(cnt) < 4:
    print('NO')
elif max_value >= 3:
    print('NO')
else:
    print('YES')

Submission status: Runtime Error

Solution code:
a1,bi = map(int, input().split())
a2,b2 = map(int, input().split())
a3,b3 = map(int, input().split())
 
ne = [1,1,2,3,4]
 
ne[max(a1,b1)] = min(a1,b1)
ne[max(a2,b2)] = ne[min(a2,b2)]
ne[max(a3,b3)] = ne[min(a3,b3)]
 
ne = set(ne)
ne = list(ne)
 
if len(ne) == 1:
  print('YES')
else:
  print('NO')

Submission status: Runtime Error

Solution code:
a1,bi = map(int, input().split())
a2,b2 = map(int, input().split())
a3,b3 = map(int, input().split())

ne = [1,1,2,3,4]

ne[max(a1,b1)] = min(a1,b1)
ne[max(a2,b2)] = ne[min(a2,b2)]
ne[max(a3,b3)] = ne[min(a3,b3)]

ne = list(set(ne))

if len(ne) == 1:
  print("YES")
else:
  print("NO")

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
d = a + b + c
if 1 in d and 2 in d and 3 in d and 4 in d:
    if a[0] in b and a[1] in b:
        if b[0] in c and b[1] in c:
            print("YES")
        else:
        print("NO")
    if a[0] in c and a[1] in c:
        if c[0] in b and c[1] in b:
            print("YES")
        else:
        print("NO")
        
    if c[0] in b and c[1] in b:
        if b[0] in a and b[1] in a:
            print("YES")
        else:
        print("NO")
    if c[0] in a and c[1] in a:
        if a[0] in b and a[1] in b:
            print("YES")
        else:
        print("NO")
        
    if b[0] in c and b[1] in c:
        if c[0] in a and c[1] in a:
            print("YES")
        else:
        print("NO")
    if b[0] in a and b[1] in a:
        if a[0] in c and a[1] in c:
            print("YES")
        else:
        print("NO")
    else:
        print("NO")
    
else:
    print('NO')

Submission status: Runtime Error

Solution code:
import sys

x = []
for _ in range(3):
    x.extend(list(map(int,input().split())))
cnt = [0]*4
for i in range(6):
    cnt[x[i]-1] += 1
for a in cnt:
    if a > 2:
        print("NO")
        sys.exit(1)
print("YES")

Submission status: Runtime Error

Solution code:
#失恋してメンタル死んでるのでコードもシンデマス
 
dic = {}
key = []
item = []
res_flag = True

for i in range(3):
    a,b = map(int,input().split())
    dic[a] = b
    key.append(a)
    item.append(b)
 
for i in key:
    flag = True
    tmp_key = key
    tmp_item = item
    
    a = i
    while flag:
        if a in key:
        	a = dic[a]
            tmp_key.remove(a)
            tmp_item.remove(dic[a])
            
        else:
            flag = False
        
    if len(tmp_item) == 0 and len(tmp_key) == 0:
        res = "YES"
        res_flag = False

if res_flag:
    res = "NO"
    
    print(res)

Submission status: Runtime Error

Solution code:
p = int(input().split())
p.extend(int(input().split()))
p.extend(int(input().split()))
#print(p)
count_list = []
for i in range(4):
   count =  p.count(i+1)
   count_list.append(count)
#==
count_list2 = []
for j in range(2):
   count2 = count_list2.count(j+1)
   count2_list.append(count2)
#==
if(count2_list.count(1)==2 and count2_list.count(1)==2):
   print("YES")
else:
   print("NO")

Submission status: Runtime Error

Solution code:
dic = {}
key = []
item = []
for i in range(3):
    a,b = map(int,input().split())
    
    key.append(a)
    item.append(b)

for i in range(1,5):
    flag = True
    tmp_key = key
    tmp_item = item
    
    a = i
    while flag:
        if dic[a] in tmp_item:
            a = dic[a]
            tmp_key.remove(a)
            tmp_item.remove(dic[a])
            
        else:
            flag = False
        
    if len(tmp_item) == 0 and len(tmp_key) == 0:
        print("YES")
    else:
        print("NO")

Submission status: Runtime Error

Solution code:
dic = {}
key = []
item = []
for i in range(3):
    a,b = map(int,input().split())
    dic[a] = b
    key.append(a)
    item.append(b)

for i in range(1,5):
    flag = True
    tmp_key = key
    tmp_item = item
    
    a = i
    while flag:
        if dic[a] in tmp_item:
            a = dic[a]
            tmp_key.remove(a)
            tmp_item.remove(dic[a])
            
        else:
            flag = False
        
    if len(tmp_item) == 0 and len(tmp_key) == 0:
        print("YES")
    else:
        print("NO")

Submission status: Runtime Error

Solution code:
#失恋してメンタル死んでるのでコードもシンデマス

dic = {}
key = []
item = []

for i in range(3):
    a,b = map(int,input().split())
    dic[a] = b
    key.append(a)
    item.append(b)

for i in key:
    flag = True
    tmp_key = key
    tmp_item = item
    
    a = i
    while flag:
        if a in key:
        	a = dic[a]
            tmp_key.remove(a)
            tmp_item.remove(dic[a])
            
        else:
            flag = False
        
    if len(tmp_item) == 0 and len(tmp_key) == 0:
        res = "YES"
        res_flag = False
if res_flag:
  res = "NO"

print(res)

Submission status: Runtime Error

Solution code:
#失恋してメンタル死んでるのでコードもシンデマス

dic = {}
key = []
item = []
res_flag = True
for i in range(3):
    a,b = map(int,input().split())
    dic[a] = b
    key.append(a)
    item.append(b)

for i in key:
    flag = True
    tmp_key = key
    tmp_item = item
    
    a = i
    while flag:
        if a in key:
            tmp_key.remove(a)
            tmp_item.remove(dic[a])
            a = dic[a]
        else:
            flag = False
        
    if len(tmp_item) == 0 and len(tmp_key) == 0:
        res = "YES"
        res_flag = False
if res_flag:
  res = "NO"

print(res)

Submission status: Runtime Error

Solution code:
import sys

x = []
for _ in range(3):
    x.extend(list(map(int,input().split())))
a = b = c = d = 0
for i in range(6):
    if x[i] == 1:
        a += 1
    if x[i] == 2:
        b += 1
    if x[i] == 3:
        c += 1
    if x[i] == 4:
        d += 1
if a == 3:
    print("NO")
    sys.exit(1)
if b == 3:
    print("NO")
    sys.exit(1)
if c == 3:
    print("NO")
    sys.exit(1)
if d == 3:
    print("NO")
    sys.exit(1)
print("YES")

Submission status: Runtime Error

Solution code:
#失恋してメンタル死んでるのでコードもシンデマス

dic = {}
key = []
item = []
for i in range(3):
    a,b = map(int,input().split())
    dic[a] = b
    key.append(a)
    item.append(b)

for i in range(1,5):
    flag = True
    tmp_key = key
    tmp_item = item
    
    a = i
    while flag:
        if a in key:
            tmp_key.remove(a)
            tmp_item.remove(dic[a])
            a = dic[a]
        else:
            flag = False
        
    if len(tmp_item) == 0 and len(tmp_key) == 0:
        res = "YES"
        res_flag = False
if res_flag:
  res = "NO"

print(res)

Submission status: Runtime Error

Solution code:

for i in range(n):
    a,b = input().split()
    li.append(a)
    li.append(b)
    
an = li.count("1")+li.count("2")+li.count("3")+li.count("4")
if an >= 6:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
import sys
num =[]
for i in range(3):
    x,y = map(int,input().split(" "))
    num.append(x)
    num.append(y)
for i in range(1,4):
    if num.count(i)=3:
        print("NO")
        sys.exit()
print("YES")

Submission status: Runtime Error

Solution code:
lst[0], lst[1] = [int(i) for i in input().split()]
lst[2], lst[3] = [int(i) for i in input().split()]
lst[4], lst[5]  = [int(i) for i in input().split()]

flag = [False, False, False, False]

f = 1
for i in range(1, 4+1):
    if (lst.count(i) == 0) or (lst.count(i) == 3):
        print("NO")
        f = 0
        break

if f == 1:
    print("YES")

Submission status: Runtime Error

Solution code:
ll=list()
for i in range(3):
    a=input()
    b=a.split()
    ll.append(int(b[0]),int(b[1]))
c1=ll.count(1)
c2=ll.count(2)
c3=ll.count(3)
c4=ll.count(4)
if c1>2 or c2>2 or c3>2 or c4>2:
    print("No")
else:
    print("Yes")

Submission status: Runtime Error

Solution code:
import sys

x = []

for _ in range(3):
    x.extend(list(map(int,input().split())))
x.sort()
a = b = c = d = 0
for i in range(6):
    if x[i] == 1:
        a += 1
    elif x[i] == 2:
        b += 1
    elif x[i] == 3:
        c += 1
    else:
        d += 1
if a > 2 or a < 0:
    print("NO")
    sys.exit(1)
elif b > 2 or b < 0:
    print("NO")
    sys.exit(1)
elif c > 2 or c < 0:
    print("NO")
    sys.exit(1)
elif d > 2 or d < 0:
    print("NO")
    sys.exit(1)
print("YES")

Submission status: Runtime Error

Solution code:
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    if c == 0: continue
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())

Submission status: Runtime Error

Solution code:
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.append(b[0])
a.append(b[1])
a.append(c[0])
a.append(c[1])
x = [0] * 4

for i in a:
    x[a] += 1

for i in range(4):
    if x[i] in [1, 2]:
        print('YES')
    else:
        print('NO')

Submission status: Runtime Error

Solution code:
a1,b1=map(int,input().split())
a2,b3=map(int,input().split())
a2,b3=map(int,input().split())
m = [a1,b1,a2,b2,a3,b3]

n={1:0,2:0,3:0,4:0}
for x in m:
    n[x]+=1
    
t=0
for i in range(3):
    i+=1
    if n[i] != 1 and n[i] != 2:
        t=1
        
if t == 0:
    print("YES")
else:
    print("NO")

Submission status: Runtime Error

Solution code:
lst = [9, 9, 9, 9, 9, 9]
lst[0], lst[1] = [int(i) for i in input().split()]
lst[2], lst[3] = [int(i) for i in input().split()]
lst[4], lst[5]  = [int(i) for i in input().split()]

flag = [False, False, False, False]
lst = list(set(lst))

if i in range(4):
    if i not in lst:
        print("NO")
        exit()

print("YES")

Submission status: Runtime Error

Solution code:
def solve():
  count = [0] * 4
  for i in range(3):
    A, B = map(int, input().split())
    count[A - 1] += 1
    count[B - 1] += 1

  time = [0] * 2
  for c in count:
    time[c - 1] += 1

  return 'YES' if time[0] == 2 and time[1] == 2 else 'NO'

print(solve())

Submission status: Runtime Error

Solution code:
a, b = map(int, raw_input().split())
cnt[a] +=1
cnt[b] +=1
a, b = map(int, raw_input().split())
cnt[a] +=1
cnt[b] +=1
a, b = map(int, raw_input().split())
cnt[a] +=1
cnt[b] +=1
if max(cnt) == 3:print"NO"
else:print "YES"

Submission status: Runtime Error

Solution code:
a = []
b = []
c = [0,0,0,0]
for i in range(3):
  ab = list(map(int,input().split()))
  a.append(ab[0])
  b.append(ab[1])
  c[ab[0]] += 1
  c[ab[1]] += 1
k = c.index(1)
for i in range(3):
  if k in a:
    j = a.index(k)
    k = b[j]
  else:
    print("NO")
    break
else:
  print("YES")

Submission status: Runtime Error

Solution code:
 A = []
 B = []
 for i in range(3):
     a, b = [int(n) for n in input().split()]
     A.append(a)
     B.append(b)

 counter = [0] * 4

 for i in range(3):
     counter[A[i] - 1] += 1
     counter[B[i] - 1] += 1

 oddscounter = 0

 for i in range(4):
     if counter[i] % 2 == 1:
         oddscounter += 1

 answer = ""
 if oddscounter >= 3:
     answer = "NO"
 else:
     answer = "YES"

 print(answer)

Submission status: Runtime Error

Solution code:
lis = [0,0,0,0]
for n,m in lis(map(int,input().split())):
  lis[n-1] += 1
  lis[m-1] += 1
if 3 in lis:
  print("NO")
else:
  print("YES")

Submission status: Runtime Error

Solution code:
vec = [0 for _ in range(3)]
for i in range(3):
    a,b = list(map(int,input().split()))
    a-=1
    b-=1
    vec[a]+=1
    vec[b]+=1

cnt = 0
for x in vec:
    if x%2==1:
        cnt+=1

if cnt >2:
    print('NO')
else:
    print('YES')