Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

直方体

アイヅ放送協会の教育番組(ＡＨＫ教育)では、子供向けの工作番組「あそんでつくろ」という番組を放送しています。今日は画用紙で箱を作る回ですが、用意した長方形の画用紙で直方体ができるかを確かめたいと思います。ただし、画用紙は切ったり折ったりしてはいけません。

６つの長方形が与えられるので、それらを使って直方体が作れるかどうか判定するプログラムを作成せよ。

Input

入力は以下の形式で与えられる。

h1 w1
h2 w2
h3 w3
h4 w4
h5 w5
h6 w6

入力は６行からなり、それぞれの行に各長方形の縦の長さを表す整数 hi (1 ≤ hi ≤ 1000) と横の長さを表す整数 wi (1 ≤ wi ≤ 1000) が与えられる。

Output

直方体を作成できる場合には「yes」を、作成できない場合には「no」を出力する。ただし、立方体は直方体の一種なので、立方体の場合でも「yes」と出力する。

Sample Input 1

2 2
2 3
2 3
2 3
2 2
3 2

Sample Output 1

yes

Sample Input 2

2 2
2 3
2 3
2 3
2 2
2 2

Sample Output 2

no



Sample input:
2 2
2 3
2 3
2 3
2 2
3 2


Sample output:
yes

Submission status: Wrong Answer

Solution code:
A = sorted(sorted(map(int, input().split())) for i in range(6))
if all(a==b for a, b in zip(A[::2], A[1::2])):
    print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
A = sorted(sorted(map(int, input().split())) for i in range(6))
if all(a==b for a, b in zip(A[::2], A[1::2])):
    p, q, r = A[::2]
    if (p[0] in q and p[1] in r and q[q.index(p[0])^1] == r[r.index(p[1])^1]) or (p[0] in r and p[1] in q and r[r.index(p[0])^1] == q[q.index(p[1])^1]):
        print("yes")
else:
    print("no")

Submission status: Wrong Answer

Solution code:
a = []
for _ in range(6):a.append(sorted(list(map(int, input().split()))))
a.sort(key = lambda x:x[1])
a.sort(key = lambda x:x[0])
print("yes" if a[0] == a[1] and a[2] == a[3] and a[4] == a[5] and a[0][0] == a[2][0] and a[0][1] == a[3][0] and a[2][1] == a[3][1] else "no")

Submission status: Wrong Answer

Solution code:
lst = [set(map(int, input().split())) for _ in range(6)]
rec = []
while lst:
  x = lst[0]
  count = lst.count(x)
  if count % 2 == 1:
    print("no")
    break
  rec.append((count, x))
  for _ in range(count):
    lst.pop(lst.index(x))
else:
  if len(rec) == 1:
    if len(rec[0][1]) == 1:
      print("yes")
    else:
      print("no")
  elif len(rec) == 2:
    rec.sort()
    if rec[0][1] & rec[1][1] == rec[0][1]:
      print("yes")
    else:
      print("no")
  elif len(rec) == 3:
    if len(rec[0][1]) == len(rec[1][1]) == len(rec[2][1]) == 2 and (rec[2][1] in rec[0][1] | rec[1][1]):
      print("yes")
    else:
      print("no")

Submission status: Accepted

Solution code:
c=[[0,0]]*6
for i in range(6):
    a,b=sorted(map(int,input().split()))
    c[i]=[a,b]
c.sort()
for i in range(0,6,2):
    if c[i]!=c[i+1]:print('no');break
else:print(['no','yes'][c[0][0]==c[2][0] and c[0][1]==c[4][0] and c[2][1]==c[4][1]])

Submission status: Accepted

Solution code:
A = sorted(sorted(map(int, input().split())) for i in range(6))
if all(a==b for a, b in zip(A[::2], A[1::2])):
    p, q, r = A[::2]
    if (p[0] in q and p[1] in r and q[q.index(p[0])^1] == r[r.index(p[1])^1]) or (p[0] in r and p[1] in q and r[r.index(p[0])^1] == q[q.index(p[1])^1]):
        print("yes")
    else:
        print("no")
else:
    print("no")

Submission status: Accepted

Solution code:
a = []
for _ in range(6):a.append(sorted(list(map(int, input().split()))))
a.sort(key = lambda x:x[1])
a.sort(key = lambda x:x[0])
print("yes" if a[0] == a[1] and a[2] == a[3] and a[4] == a[5] and a[0][0] == a[2][0] and a[0][1] == a[4][0] and a[2][1] == a[4][1] else "no")

Submission status: Accepted

Solution code:
lst = [set(map(int, input().split())) for _ in range(6)]
rec = []
while lst:
  x = lst[0]
  count = lst.count(x)
  if count % 2 == 1:
    print("no")
    break
  rec.append((count, x))
  for _ in range(count):
    lst.pop(lst.index(x))
else:
  if len(rec) == 1:
    if len(rec[0][1]) == 1:
      print("yes")
    else:
      print("no")
  elif len(rec) == 2:
    rec.sort()
    if rec[0][1] & rec[1][1] == rec[0][1]:
      print("yes")
    else:
      print("no")
  elif len(rec) == 3:
    if len(rec[0][1]) == len(rec[1][1]) == len(rec[2][1]) == 2 and (rec[2][1] & (rec[0][1] | rec[1][1]) == rec[2][1]):
      print("yes")
    else:
      print("no")