Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
O = input()

class dice():
 def __init__(self, dice):
  self.dice = dice
 def S():
  one = self.dice[4]
  two = self.dice[0]
  five = self.dice[5]
  six = self.dice[1]
  InsSN(one, two, five, six)

 def InsSN(one, two, five, six):
  self.dice[0] = one
  self.dice[1] = two
  self.dice[4] = five
  self.dice[5] = six

 def N():
  one = self.dice[1]
  two = self.dice[5]
  five = self.dice[0]
  six = self.dice[4]
  InsSN(one, two, five, six)
  
 def InsWE(one, three, four, six):
  self.dice[0] = one
  self.dice[2] = three
  self.dice[4] = four
  self.dice[5] = six
 
 def W():
  one = self.dice[2]
  three = self.dice[5]
  four = self.dice[0]
  six = self.dice[3]
  InsWE(one, three, four, six)

 def E():
  one = self.dice[3]
  three = self.dice[0]
  four = self.dice[5]
  six = self.dice[2]
  InsWE(one, three, four, six)

di = dice(a)

for i in range(len(O)):
 if O[i] == 'S':
  di.S()
 elif O[i] == 'N':
  di.N()
 elif O[i] == 'E':
  di.E()
 elif O[i] == 'W':
  di.W()

print(di.dice[0])





 













  

Fixed submission:
d = list(map(int, input().split()))
order = input()
class Dice():
    def __init__(self, d):
        self.dice = d

    def InsSN(self, one, two, five, six):
        self.dice[0] = one
        self.dice[1] = two
        self.dice[4] = five
        self.dice[5] = six
        
    def InsWE(self, one, three, four, six):
        self.dice[0] = one
        self.dice[2] = three
        self.dice[3] = four
        self.dice[5] = six

    def S(self):
        one = self.dice[4]
        two = self.dice[0]
        five = self.dice[5]
        six = self.dice[1]
        self.InsSN(one, two, five, six)

    def N(self):
        one = self.dice[1]
        two = self.dice[5]
        five = self.dice[0]
        six = self.dice[4]
        self.InsSN(one, two, five, six)
 
    def W(self):
        one = self.dice[2]
        three = self.dice[5]
        four = self.dice[0]
        six = self.dice[3]
        self.InsWE(one, three, four, six)
        
    def E(self):
        one = self.dice[3]
        three = self.dice[0]
        four = self.dice[5]
        six = self.dice[2]
        self.InsWE(one, three, four, six)
        
    def roll(self, order):
        if order == 'S':
            self.S()
        elif order == 'N':
            self.N()
        elif order == 'E':
            self.E()
        elif order == 'W':
            self.W()
d = Dice(d)
for o in order:
    d.roll(o)
print(d.dice[0])

Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
O = input()

class Dice():
 def __init__(self, d):
  self.dice = d
 def S():
  one = self.dice[4]
  two = self.dice[0]
  five = self.dice[5]
  six = self.dice[1]
  InsSN(one, two, five, six)

 def InsSN(one, two, five, six):
  self.dice[0] = one
  self.dice[1] = two
  self.dice[4] = five
  self.dice[5] = six

 def N():
  one = self.dice[1]
  two = self.dice[5]
  five = self.dice[0]
  six = self.dice[4]
  InsSN(one, two, five, six)
  
 def InsWE(one, three, four, six):
  self.dice[0] = one
  self.dice[2] = three
  self.dice[4] = four
  self.dice[5] = six
 
 def W():
  one = self.dice[2]
  three = self.dice[5]
  four = self.dice[0]
  six = self.dice[3]
  InsWE(one, three, four, six)

 def E():
  one = self.dice[3]
  three = self.dice[0]
  four = self.dice[5]
  six = self.dice[2]
  InsWE(one, three, four, six)

di = Dice(a)

for i in range(len(O)):
 if O[i] == 'S':
  di.S()
 elif O[i] == 'N':
  di.N()
 elif O[i] == 'E':
  di.E()
 elif O[i] == 'W':
  di.W()

print(di.dice[0])





 













  

Fixed submission:
d = list(map(int, input().split()))
order = input()
class Dice():
    def __init__(self, d):
        self.dice = d

    def InsSN(self, one, two, five, six):
        self.dice[0] = one
        self.dice[1] = two
        self.dice[4] = five
        self.dice[5] = six
        
    def InsWE(self, one, three, four, six):
        self.dice[0] = one
        self.dice[2] = three
        self.dice[3] = four
        self.dice[5] = six

    def S(self):
        one = self.dice[4]
        two = self.dice[0]
        five = self.dice[5]
        six = self.dice[1]
        self.InsSN(one, two, five, six)

    def N(self):
        one = self.dice[1]
        two = self.dice[5]
        five = self.dice[0]
        six = self.dice[4]
        self.InsSN(one, two, five, six)
 
    def W(self):
        one = self.dice[2]
        three = self.dice[5]
        four = self.dice[0]
        six = self.dice[3]
        self.InsWE(one, three, four, six)
        
    def E(self):
        one = self.dice[3]
        three = self.dice[0]
        four = self.dice[5]
        six = self.dice[2]
        self.InsWE(one, three, four, six)
        
    def roll(self, order):
        if order == 'S':
            self.S()
        elif order == 'N':
            self.N()
        elif order == 'E':
            self.E()
        elif order == 'W':
            self.W()
d = Dice(d)
for o in order:
    d.roll(o)
print(d.dice[0])

Buggy python submission (verdict: Runtime Error):
a = list(map(int, input().split()))
O = input()

class Dice():
 def __init__(self, d):
  self.dice = d
 def S(self):
  one = self.dice[4]
  two = self.dice[0]
  five = self.dice[5]
  six = self.dice[1]
  InsSN(one, two, five, six)

 def InsSN(self, one, two, five, six):
  self.dice[0] = one
  self.dice[1] = two
  self.dice[4] = five
  self.dice[5] = six

 def N(self):
  one = self.dice[1]
  two = self.dice[5]
  five = self.dice[0]
  six = self.dice[4]
  InsSN(one, two, five, six)
  
 def InsWE(self, one, three, four, six):
  self.dice[0] = one
  self.dice[2] = three
  self.dice[4] = four
  self.dice[5] = six
 
 def W(self):
  one = self.dice[2]
  three = self.dice[5]
  four = self.dice[0]
  six = self.dice[3]
  InsWE(one, three, four, six)

 def E(self):
  one = self.dice[3]
  three = self.dice[0]
  four = self.dice[5]
  six = self.dice[2]
  InsWE(one, three, four, six)

di = Dice(a)

for i in range(len(O)):
 if O[i] == 'S':
  di.S()
 elif O[i] == 'N':
  di.N()
 elif O[i] == 'E':
  di.E()
 elif O[i] == 'W':
  di.W()

print(di.dice[0])





 













  

Fixed submission:
d = list(map(int, input().split()))
order = input()
class Dice():
    def __init__(self, d):
        self.dice = d

    def InsSN(self, one, two, five, six):
        self.dice[0] = one
        self.dice[1] = two
        self.dice[4] = five
        self.dice[5] = six
        
    def InsWE(self, one, three, four, six):
        self.dice[0] = one
        self.dice[2] = three
        self.dice[3] = four
        self.dice[5] = six

    def S(self):
        one = self.dice[4]
        two = self.dice[0]
        five = self.dice[5]
        six = self.dice[1]
        self.InsSN(one, two, five, six)

    def N(self):
        one = self.dice[1]
        two = self.dice[5]
        five = self.dice[0]
        six = self.dice[4]
        self.InsSN(one, two, five, six)
 
    def W(self):
        one = self.dice[2]
        three = self.dice[5]
        four = self.dice[0]
        six = self.dice[3]
        self.InsWE(one, three, four, six)
        
    def E(self):
        one = self.dice[3]
        three = self.dice[0]
        four = self.dice[5]
        six = self.dice[2]
        self.InsWE(one, three, four, six)
        
    def roll(self, order):
        if order == 'S':
            self.S()
        elif order == 'N':
            self.N()
        elif order == 'E':
            self.E()
        elif order == 'W':
            self.W()
d = Dice(d)
for o in order:
    d.roll(o)
print(d.dice[0])

Buggy python submission (verdict: Runtime Error):
d = list(map(int, input().split()))
O = input()

class Dice():
 def __init__(self, d):
  self.dice = d
 def S(self):
  one = self.dice[4]
  two = self.dice[0]
  five = self.dice[5]
  six = self.dice[1]
  InsSN(one, two, five, six)

 def InsSN(self, one, two, five, six):
  self.dice[0] = one
  self.dice[1] = two
  self.dice[4] = five
  self.dice[5] = six

 def N(self):
  one = self.dice[1]
  two = self.dice[5]
  five = self.dice[0]
  six = self.dice[4]
  InsSN(one, two, five, six)
  
 def InsWE(self, one, three, four, six):
  self.dice[0] = one
  self.dice[2] = three
  self.dice[4] = four
  self.dice[5] = six
 
 def W(self):
  one = self.dice[2]
  three = self.dice[5]
  four = self.dice[0]
  six = self.dice[3]
  InsWE(one, three, four, six)

 def E(self):
  one = self.dice[3]
  three = self.dice[0]
  four = self.dice[5]
  six = self.dice[2]
  InsWE(one, three, four, six)

d = Dice(d)

for i in range(len(O)):
 if O[i] == 'S':
  d.S()
 elif O[i] == 'N':
  d.N()
 elif O[i] == 'E':
  d.E()
 elif O[i] == 'W':
  d.W()

print(d.dice[0])





 













  

Fixed submission:
d = list(map(int, input().split()))
order = input()
class Dice():
    def __init__(self, d):
        self.dice = d

    def InsSN(self, one, two, five, six):
        self.dice[0] = one
        self.dice[1] = two
        self.dice[4] = five
        self.dice[5] = six
        
    def InsWE(self, one, three, four, six):
        self.dice[0] = one
        self.dice[2] = three
        self.dice[3] = four
        self.dice[5] = six

    def S(self):
        one = self.dice[4]
        two = self.dice[0]
        five = self.dice[5]
        six = self.dice[1]
        self.InsSN(one, two, five, six)

    def N(self):
        one = self.dice[1]
        two = self.dice[5]
        five = self.dice[0]
        six = self.dice[4]
        self.InsSN(one, two, five, six)
 
    def W(self):
        one = self.dice[2]
        three = self.dice[5]
        four = self.dice[0]
        six = self.dice[3]
        self.InsWE(one, three, four, six)
        
    def E(self):
        one = self.dice[3]
        three = self.dice[0]
        four = self.dice[5]
        six = self.dice[2]
        self.InsWE(one, three, four, six)
        
    def roll(self, order):
        if order == 'S':
            self.S()
        elif order == 'N':
            self.N()
        elif order == 'E':
            self.E()
        elif order == 'W':
            self.W()
d = Dice(d)
for o in order:
    d.roll(o)
print(d.dice[0])