Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g=list(''.join(g)*2)
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 else:
  if i==3:print('Yes')

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g=list(''.join(g)*2)
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0245',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]2
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
#f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f=[str(e[i])for i in range(1,5)]
f+=f
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
e[3],e[4]=e[4],e[3]
t=0
for i in range(6):
 m={0:'012345',1:'152304',2:'215043',3:'310542',4:'402351',5:'513240'}[i]
 f=[d[int(j)]for j in m];f[3],f[4]=f[4],f[3]
 if f[0]==e[0]:
  for j in range(4):
   if f[1:5]*2[j:j+4]==e[1:5]:t=1;break
print(('No','Yes')[t==1])

Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])

Buggy python submission (verdict: Runtime Error):
d,e=[list(map(int,input().split()))for _ in range(2)]
m={0:'1234',1:'5230',2:'1504',3:'1054',4:'0235',5:'1324'}[d.index(e[0])]
f=[str(e[i])for i in range(1,5)]+[str(e[1])]
f[2],f[3]=f[3],f[2]
g=[str(d[int(i)])for i in m]
g[2],g[3]=g[3],g[2]
g+=g
for i in range(4):
 if g[g.index(f[i])+1]!=f[i+1]:print('No');break
 elif i==3:print('Yes')


Fixed submission:
d,e=[input().split()for _ in'12'];e[3:5]=e[4],e[3]
t=0
for p in('012345','152304','215043','310542','402351','513240'):
 f=[d[int(j)]for j in p];f[3:5]=f[4:2:-1]
 if f[0]==e[0]:
  f=f[1:5]*2
  for j in range(4):
   if f[j:j+4]==e[1:5]:t=1
print(('No','Yes')[t])