Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
else a > b;
    print('a > b')
else:
    print('a == b'(

Fixed submission:
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')

Buggy python submission (verdict: Runtime Error):
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
else a > b;
    print('a > b')
else:
    print('a == b')

Fixed submission:
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')

Buggy python submission (verdict: Runtime Error):
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elsF a > b;
    print('a > b')
else:
    print('a == b')

Fixed submission:
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')

Buggy python submission (verdict: Runtime Error):
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b;
    print('a > b')
else:
    print('a == b')

Fixed submission:
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
Buggy python submission (verdict: Runtime Error):
nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a < b < c:
    print('Yes')
elif;
    print('No')

Fixed submission:
nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a < b < c:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
W,H,x,y,r=map(int,raw_input().split())
if (x-r)>=0 and W>=(x+r) and (y-r)>=0 and H>=(y+r):
    print "Yes"
else:
    print "No"

Fixed submission:
import sys
(W, H, x, y, r) = [int(i) for i in sys.stdin.readline().split()]
if r <= x <= W - r and r <= y <= H - r:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
while True:
    (H, W) = [int(i) for i in input().split()]
    if H == W == 0:
       break
 
    for a in range(H):
        for b in range(W):
            print('#', end='')
        print()
    print()

Fixed submission:
import sys
(W, H, x, y, r) = [int(i) for i in sys.stdin.readline().split()]
if r <= x <= W - r and r <= y <= H - r:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
while True:
    (H, W) = [int(i) for i in input().split()]
    if H == W == 0:
       break
 
    for a in range(H):
        for b in range(W):
            print('#', end='')
        print()
    print()

Fixed submission:
import sys
(W, H, x, y, r) = [int(i) for i in sys.stdin.readline().split()]
if r <= x <= W - r and r <= y <= H - r:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
using namespace std;
 
typedef long long ll;
 
int main() {
    string str; getline(cin, str);
    for (int i = 0; i < str.size(); ++i) {
        char c = str[i];
        if ('a' <= c && c <= 'z') cout << (char)(c-'a'+'A');
        else if ('A' <= c && c <= 'Z') cout << (char)(c-'A'+'a');
        else cout << c;
    }
    cout << endl;
}

Fixed submission:
import sys
print(sys.stdin.readline().strip().swapcase())
Buggy python submission (verdict: Runtime Error):
import collections
import string
??
def solve(s):
????????s = s.lower()
????????counter = collections.Counter(s)
????????lows = string.ascii_lowercase
????????cnt = [counter[ch] for ch in lows]
????????for (ch, n) in zip(lows, cnt):
????????????????print('{0} : {1}'.format(ch, n))
??
if __name__ == '__main__':
????????s = ''
????????while True:
????????????????try:
????????????????????????s += input()
????????????????except:
????????????????????????break
????????solve(s)

Fixed submission:
sentence = ''
while True:
    try:
        sentence += input().lower()
    except:
        break
 
for i in range(ord('a') , ord('z') + 1):
    print('{} : {}'.format(chr(i),sentence.count(chr(i))))

Buggy python submission (verdict: Runtime Error):
using namespace std;
 
int main(void){
    char c;
    int num[26]={};
    while (scanf("%c",&c) != EOF) {
        c = tolower(c);
        if (c >= 'a' && c<='z') num[c-'a']++;
    }
    for (int i = 0; i < 26; i++) {
        printf("%c : %d\n", i+'a',num[i]);
    }
    return 0;
}

Fixed submission:
sentence = ''
while True:
    try:
        sentence += input().lower()
    except:
        break
 
for i in range(ord('a') , ord('z') + 1):
    print('{} : {}'.format(chr(i),sentence.count(chr(i))))
Buggy python submission (verdict: Runtime Error):
while True:
    s = raw_input()
    if s == "-":
        break
 
    for i in range(int(raw_input())):
        h = int(raw_input())
        s = s[h:] + s[0:h]
 
    print(s)

Fixed submission:
import sys
 
def shuffle( cards ):
    h = int( sys.stdin.readline() )
    cards = cards[ h : ] + cards[ 0 : h ]
    return cards
 
while True:
    cards = sys.stdin.readline().rstrip()
    if '-' == cards:
        break
    m = int( sys.stdin.readline() )
    for i in range( m ):
        cards = shuffle( cards )
    print( cards )

Buggy python submission (verdict: Runtime Error):
while True:
    s = raw_input()
    if s == "-":
        break
 
    for i in range(int(raw_input())):
        h = int(raw_input())
        s = s[h:] + s[0:h]
 
    print(s)

Fixed submission:
import sys
 
def shuffle( cards ):
    h = int( sys.stdin.readline() )
    cards = cards[ h : ] + cards[ 0 : h ]
    return cards
 
while True:
    cards = sys.stdin.readline().rstrip()
    if '-' == cards:
        break
    m = int( sys.stdin.readline() )
    for i in range( m ):
        cards = shuffle( cards )
    print( cards )

Buggy python submission (verdict: Runtime Error):
while True:
    s = raw_input()
    if s == "-":
        break
 
    for i in range(int(raw_input())):
        h = int(raw_input())
        s = s[h:] + s[0:h]
 
    print(s)

Fixed submission:
import sys
 
def shuffle( cards ):
    h = int( sys.stdin.readline() )
    cards = cards[ h : ] + cards[ 0 : h ]
    return cards
 
while True:
    cards = sys.stdin.readline().rstrip()
    if '-' == cards:
        break
    m = int( sys.stdin.readline() )
    for i in range( m ):
        cards = shuffle( cards )
    print( cards )
Buggy python submission (verdict: Runtime Error):
imort math
x1,y1,x2,y2=map(float,input().split())
d=math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))
print(d)

Fixed submission:
import math
x1,y1,x2,y2=map(float,input().split())
d=math.sqrt(pow(x1-x2,2)+pow(y1-y2,2))
print(d)

Buggy python submission (verdict: Runtime Error):
imort math
x1,y1,x2,y2=map(float,input().split())
d=math.sqrt(pow(x1-x2,2)+pow(y1-y2,2))
print(d)

Fixed submission:
import math
x1,y1,x2,y2=map(float,input().split())
d=math.sqrt(pow(x1-x2,2)+pow(y1-y2,2))
print(d)
Buggy python submission (verdict: Runtime Error):
i int x,y ;
x=input();
y=x^3 ;
print y ;

Fixed submission:
x=input();
y=x*x*x ;
print y ;

Buggy python submission (verdict: Runtime Error):
int x,y ;
x=input();
y=x^3 ;
print y ;

Fixed submission:
x=input();
y=x*x*x ;
print y ;

Buggy python submission (verdict: Runtime Error):
x=input();
y=x*x*x ;
print y ;
return 0;

Fixed submission:
x=input();
y=x*x*x ;
print y ;
Buggy python submission (verdict: Runtime Error):
a=input();
b=input();
d=a*b;
l=2*(a+b) ;
print d l ;

Fixed submission:
a,b = map(int,raw_input().split())
print a*b,2*(a+b)
Buggy python submission (verdict: Runtime Error):
a,b= map(int,input().split());
if a < b :
	print("%d < %d" % (a,b));
elif a > b :
	print("%d > %d" % (a,b));
elif a == b :
	print("%d == %d" %(a,b)) ;

Fixed submission:
a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;

Buggy python submission (verdict: Runtime Error):
a,b= map(int,raw_input().split());
if a<b ;
  print "a<b";
else if a>b ;
  print "a>b";
else
  print "a==b" ;

Fixed submission:
a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;

Buggy python submission (verdict: Runtime Error):
a,b= map(int,raw_input().split());
if a<b ;
  print 'a<b';
else if a>b ;
  print 'a>b';
else
  print 'a==b' ;

Fixed submission:
a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;

Buggy python submission (verdict: Runtime Error):
a,b= map(int,raw_input().split());
if a<b ;
  print 'a<b';
elif a>b ;
  print 'a>b';
else
  print 'a==b' ;

Fixed submission:
a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;

Buggy python submission (verdict: Runtime Error):
a,b= map(int,raw_input().split());
if a<b :
  print 'a<b';
elif a>b :
  print 'a>b';
else
  print 'a==b' ;

Fixed submission:
a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;

Buggy python submission (verdict: Runtime Error):
a,b= map(int,raw_input().split())
if a<b :
  print 'a<b'
elif a>b 
  print 'a>b'
else:
  print 'a==b' 

Fixed submission:
a,b= map(int,input().split());
if a < b :
	print("a < b" );
elif a > b :
	print("a > b" );
elif a == b :
	print("a == b") ;
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,raw_input().split())
if(a<b and b<c) :
	print 'Yes'
else
	print 'No'

Fixed submission:
a,b,c=map(int,raw_input().split())
if(a<b and b<c) :
	print 'Yes'
else:
	print 'No'
Buggy python submission (verdict: Runtime Error):
a,b = map(int,raw_input()) 
d=a/b
r=a%b
f=1.0*a/b
print d,r,f

Fixed submission:
a,b = map(int,raw_input().split()) 
d=a/b
r=a%b
f=1.0*a/b
print "%d %d %.5f" %( d,r,f)

Buggy python submission (verdict: Runtime Error):
a,b = map(int,raw_input()) 
d=a/b
r=a%b
f=1.0*a/b
print d,r,f

Fixed submission:
a,b = map(int,raw_input().split()) 
d=a/b
r=a%b
f=1.0*a/b
print "%d %d %.5f" %( d,r,f)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=[int(i) for i in input().split]
print(min(s),max(s),sum(s))

Fixed submission:
input()
s=[int(i) for i in input().split()]
print(min(s),max(s),sum(s))

Buggy python submission (verdict: Runtime Error):
input()
s=[int(i) for i in input().split]
print(min(s),max(s),sum(s))

Fixed submission:
input()
s=[int(i) for i in input().split()]
print(min(s),max(s),sum(s))
Buggy python submission (verdict: Runtime Error):
while(not((m==-1) and (f==-1) and (r==-1)))
 m,f,r=map(int,input().split())
 if((m==-1) or (f==-1))
   print('F')

 if(m+f>=80)
   print('A')

 if(65<= m+f) and (m+f<80))
   print('B')

 if(50<= m+f) and (m+f<60))
   print('C')

 if(30<= m+f) and (m+f<50))
   if(50<=r)
    print('C')
   else
    print('D')

 if(m+f<30)
   print('F')



 

Fixed submission:
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break

 if m==-1 or f==-1 :
   print('F')

 elif (m+f)>=80 :
   print('A')

 elif 65<= (m+f) and (m+f)<80 :
   print('B')

 elif 50<= (m+f) and (m+f)<65 :
   print('C')

 elif 30<=(m+f) and (m+f)<50 :
   if 50<=r :
    print('C')
   else:
    print('D')

 elif (m+f)<30 :
   print('F')

Buggy python submission (verdict: Runtime Error):
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break
 if((m==-1) or (f==-1))
   print('F')

 if(m+f>=80)
   print('A')

 if(65<= m+f) and (m+f<80))
   print('B')

 if(50<= m+f) and (m+f<60))
   print('C')

 if(30<= m+f) and (m+f<50))
   if(50<=r)
    print('C')
   else
    print('D')

 if(m+f<30)
   print('F')



 

Fixed submission:
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break

 if m==-1 or f==-1 :
   print('F')

 elif (m+f)>=80 :
   print('A')

 elif 65<= (m+f) and (m+f)<80 :
   print('B')

 elif 50<= (m+f) and (m+f)<65 :
   print('C')

 elif 30<=(m+f) and (m+f)<50 :
   if 50<=r :
    print('C')
   else:
    print('D')

 elif (m+f)<30 :
   print('F')

Buggy python submission (verdict: Runtime Error):
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break
 if((m==-1) or (f==-1))
   print('F')

 if m+f>=80 :
   print('A')

 elif m+f >= 65 :
   print('B')

 elif m+f >= 50 :
   print('C')

 elif m+f >= 30 :
   if r >= 50
    print('C')
   else
    print('D')

 if(m+f<30)
   print('F')



 

Fixed submission:
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break

 if m==-1 or f==-1 :
   print('F')

 elif (m+f)>=80 :
   print('A')

 elif 65<= (m+f) and (m+f)<80 :
   print('B')

 elif 50<= (m+f) and (m+f)<65 :
   print('C')

 elif 30<=(m+f) and (m+f)<50 :
   if 50<=r :
    print('C')
   else:
    print('D')

 elif (m+f)<30 :
   print('F')

Buggy python submission (verdict: Runtime Error):
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break

 if (m==-1) or (f==-1):
   print('F')

 if(m+f>=80):
   print('A')

 if (65<= m+f) and (m+f<80) :
   print('B')

 if (50<= m+f) and (m+f<60):
   print('C')

 if(30<= m+f) and (m+f<50):
   if (50<=r):
    print('C')
   else
    print('D')

 if(m+f<30):
   print('F')

Fixed submission:
while True:
 m,f,r=map(int,input().split())
 if m==f==r==-1 : break

 if m==-1 or f==-1 :
   print('F')

 elif (m+f)>=80 :
   print('A')

 elif 65<= (m+f) and (m+f)<80 :
   print('B')

 elif 50<= (m+f) and (m+f)<65 :
   print('C')

 elif 30<=(m+f) and (m+f)<50 :
   if 50<=r :
    print('C')
   else:
    print('D')

 elif (m+f)<30 :
   print('F')
Buggy python submission (verdict: Runtime Error):
while True:
  n,x=map(int,input().split())
  count=0
  if n==x==0 : break
  else:
  for i in range(1,n-1) :
    for j in range(i+1,n):
      for k in range(j+1,n+1):
        if i+j+k==x :
          count = count +1

  print('count')   

Fixed submission:
while True:
  n,x=map(int,input().split())
  
  if n==x==0 : break
  
  count = 0 
  for i in range(1,n-1) :
    for j in range(i+1,n):
      for k in range(j+1,n+1):
        if i+j+k==x :
          count = count +1

  print(count)
Buggy python submission (verdict: Runtime Error):
print(input.swapcase())

Fixed submission:
print(input().swapcase())
Buggy python submission (verdict: Runtime Error):
import math

while True :

x = int(input()) 

  if x == 0 :
    break 

  else :
    sum = 0 
    n=floor(log(x,10))
    sum = floor(x/pow(10,n))
    for i in reversed(xrange(n+1))
      sum = sum + floor((x%pow(10,i))/pow(10,i-1))

  print(sum)
      

  

Fixed submission:
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)

Buggy python submission (verdict: Runtime Error):
import math

while True :

x = int(input()) 

  if x == 0 :
    break 

  else :
    sum = 0 
    n=floor(log(x,10))
    sum = floor(x/pow(10,n))
    for i in reversed(range(n+1))
      sum = sum + floor((x%pow(10,i))/pow(10,i-1))

  print(sum)
      

  

Fixed submission:
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)

Buggy python submission (verdict: Runtime Error):
import math

while True :

x = int(input()) 

  if x == 0 :
    break 

  else :
    sum = 0 
    n=floor(log(x,10))
    sum = floor(x/pow(10,n))
    for i in reversed(xrange(n+1)):
      sum = sum + floor((x%pow(10,i))/pow(10,i-1))

  print(sum)

Fixed submission:
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)

Buggy python submission (verdict: Runtime Error):
while True
  x = input()
  if x == 0 :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
   sum += int(x[i])

Fixed submission:
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)

Buggy python submission (verdict: Runtime Error):
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
   sum += int(x[i])

  print(sum) 

Fixed submission:
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)

Buggy python submission (verdict: Runtime Error):
import sys
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
   sum += int(x[i])

  print(sum) 

Fixed submission:
while True :
  x = input()
  if x == '0' :
    break 

  else:
   sum = 0 
   for i  in range(len(x)) :  
    sum += int(x[i])

  print(sum)
Buggy python submission (verdict: Runtime Error):
word=input()
while(1):
  sentence=input()
  if sentence == "END_OF_TEXT"
    break
  
  snt=sentence.lower()


cnt=sentence.count(word)
print(cnt)

Fixed submission:
w= input().casefold()
 
cnt = 0
 
while(1):
    snt = input()
    if snt == "END_OF_TEXT":
        break
    sntt = snt.casefold()
    words = sntt.split()
    cnt += words.count(w)
     
print(cnt)
Buggy python submission (verdict: Runtime Error):
import math

data =map(int, raw_input().split(" "))

dx = data[2] - data[0]
dy = data[3] - data[1]

print math.sqrt(dx**2+dy**2)

Fixed submission:
import math

data =map(float, raw_input().split(" "))

dx = data[2] - data[0]
dy = data[3] - data[1]

print math.sqrt(dx**2+dy**2)

Buggy python submission (verdict: Runtime Error):
import math

data =map(int, raw_input().split(" "))

dx = data[2] - data[0]
dy = data[3] - data[1]

print math.sqrt(dx**2+dy**2)

Fixed submission:
import math

data =map(float, raw_input().split(" "))

dx = data[2] - data[0]
dy = data[3] - data[1]

print math.sqrt(dx**2+dy**2)
Buggy python submission (verdict: Runtime Error):
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def move_next_rows(self):
        temp = self.rows.pop(0)
        self.rows.append(temp)
        self.__update(self.cols, self.rows)

    def move_prev_rows(self):
        temp = self.rows.pop(3)
        self.rows.insert(0, temp)
        self.__update(self.cols, self.rows)
    
    def move_next_cols(self):
        temp = self.cols.pop(0)
        self.cols.append(temp)
        self.__update(self.rows, self.cols)
 
    def move_prev_cols(self):
        temp = self.cols.pop(3)
        self.cols.insert(0, temp)
        self.__update(self.rows, self.cols)

    def __update(self, x, y):
        x[0] = y[0]
        x[2] = y[2]
 
class DiceChecker(object):

    def __init__(self, dice1, dice2):
        self.dice1 = dice1
        self.dice2 = dice2
        self.dice1_top = self.dice1.rows[0]
        self.dice1_front = self.dice1.rows[3]
        
    def check_same_dice(self):

        is_same = False
        for _ in range(4):
            for _ in range(4):
                is_same_element = self.dice1.rows == self.dice2.rows and self.dice1.cols == self.dice2.cols
                if is_same_element:
                    is_same = True
                    break
                self.dice2.move_next_cols()
            else:     
                self.dice2.move_next_rows()
                continue
            break
        if is_same:
            print("Yes")
        else:
            print("No")
    
    def __find_num(self, x, dice):
        i = 0
        while x != dice.rows[0]:
            dice.move_next_rows()
            if i > 3:
                dice.move_next_cols()
                i = 0
            i+=1
    
    def __rot(self, dice):
        temp = dice.rows[1]
        dice.rows[1] = dice.rows[3]
        dice.rows[3] = temp

        temp = dice.cols[1]
        dice.cols[1] = dice.cols[3]
        dice.cols[3] = temp

        
d1 = list(map(int, input().split(" ")))
d2 = list(map(int, input().split(" ")))
dice1 = Dice(d1)
dice2 = Dice(d2)

dice_checker = DiceChecker(dice1, dice2)
dice_checker.check_same_dice()



Fixed submission:
class Dice:

    def __init__(self):
        d = map(int, raw_input().split(" "))
        self.c = raw_input()
        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]

    def __move_next(self, x, y):
        temp = y.pop(0)
        y.append(temp)
        x[0] = y[0]
        x[2] = y[2]

    def __move_prev(self, x, y):
        temp = y.pop(3)
        y.insert(0, temp)
        x[0] = y[0]
        x[2] = y[2]

    def execute(self):
        for i in self.c:
            self.__move(i, self.rows, self.cols)

    def __move(self, com, x, y):
        if com == "N":
            self.__move_prev(y, x)
        elif com == "S":
            self.__move_next(y, x)
        elif com == "E":
            self.__move_prev(x, y)
        elif com == "W":
            self.__move_next(x, y)

    def print_top(self):
        print self.rows[0]

dice = Dice()
dice.execute()
dice.print_top()
Buggy python submission (verdict: Runtime Error):
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def __move_next(self, x, y):
        temp = y.pop(0)
        y.append(temp)
        x[0] = y[0]
        x[2] = y[2]
 
    def __move_prev(self, x, y):
        temp = y.pop(3)
        y.insert(0, temp)
        x[0] = y[0]
        x[2] = y[2]
 
    def execute(self, c):
        for i in self.c:
            self.__move(i, self.rows, self.cols)
 
    def __move(self, com, x, y):
        if com == "N":
            self.__move_prev(y, x)
        elif com == "S":
            self.__move_next(y, x)
        elif com == "E":
            self.__move_prev(x, y)
        elif com == "W":
            self.__move_next(x, y)
 
    def print_top(self):
        print(self.rows[0])
    
    def execute2(self, a, b):

        while self.rows[0] == b:
           self.__move_next(self.rows, self.cols)
        
        while self.rows[0] == a and self.rows[1] == b:
            self.__move_next(self.cols, self.rows)
    
    def print_right_side(self):
        print(self.cols[4])
        

d = map(int, input().split(" "))
c = input() 
dice = Dice2(d)

for i in range(c):
    a, b = map(int, input().split(" "))
    dice.execute2(a,b)
    dice.print_right_side()



Fixed submission:
class Dice(object):
 
    def __init__(self, d):

        self.rows = [d[0], d[4], d[5], d[1]]
        self.cols = [d[0], d[2], d[5], d[3]]
 
    def __move_next(self, x, y):
        temp = y.pop(0)
        y.append(temp)
        x[0] = y[0]
        x[2] = y[2]
 
    def __move_prev(self, x, y):
        temp = y.pop(3)
        y.insert(0, temp)
        x[0] = y[0]
        x[2] = y[2]
 
    def execute(self, c):
        for i in c:
            self.__move(i, self.rows, self.cols)
 
    def __move(self, com, x, y):
        if com == "N":
            self.__move_prev(y, x)
        elif com == "S":
            self.__move_next(y, x)
        elif com == "E":
            self.__move_prev(x, y)
        elif com == "W":
            self.__move_next(x, y)
 
    def print_top(self):
        print(self.rows[0])
    
    def execute2(self, a, b):
        self.__rot(a)
        if a == self.rows[0] or a == self.rows[2]:
            self.__move_prev(self.cols, self.rows)    
        
        self.__rot(b)
        
        while a != self.rows[0]:
            self.__move_prev(self.cols, self.rows)    
        
        if b == self.rows[1]:
            print(self.cols[3])
        elif b == self.rows[3]:
            print(self.cols[1])
        
    def __rot(self, z):
        i = 0
        while z not in self.rows:
            self.__move_next(self.rows, self.cols)
            if i > 3:
                self.__move_next(self.cols, self.rows)
                i = 0
            i+=1

d = list(map(int, input().split(" ")))
c = int(input()) 
dice = Dice(d)

for i in range(c):
    a, b = map(int, input().split(" "))
    dice.execute2(a,b)
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
print a*b, 2*a+2*b

Fixed submission:
a,b = map(int, raw_input().split())
print a*b, 2*a+2*b

Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
print a*b, 2*a+2*b

Fixed submission:
a,b = map(int, raw_input().split())
print a*b, 2*a+2*b