output_description: Print the integer which appears on the top face after the simulation.
input_description: In the first line, six integers assigned to faces are given in ascending order
  of their corresponding labels.
  
  In the second line, a string which represents a sequence of commands, is
  given. The command is one of 'E', 'N', 'S' and 'W' representing four
  directions shown in the above figures.
attempt: n = [int(i) for i in input().split()]
  s = input()
  
  
  class Dice(object):
      def __init__(self, num):
          self.one = num[0]
          self.two = num[1]
          self.three = num[2]
          self.four = num[3]
          self.five = num[4]
          self.six = num[5]
  
      def move(self, str, state):
          if state == 0:
              if str == "N":
                  return 1
              elif str == "E":
                  return 3
              elif str == "W":
                  return 2
              elif str == "S":
                  return 4
          elif state == 1:
              if str == "N":
                  return 5
              elif str == "E":
                  return 3
              elif str == "W":
                  return 2
              elif str == "S":
                  return 0
          elif state == 2:
              if str == "N":
                  return 1
              elif str == "E":
                  return 0
              elif str == "W":
                  return 5
              elif str == "S":
                  return 4
          elif state == 3:
              if str == "N":
                  return 1
              elif str == "E":
                  return 5
              elif str == "W":
                  return 0
              elif str == "S":
                  return 4
          elif state == 4:
              if str == "N":
                  return 0
              elif str == "E":
                  return 3
              elif str == "W":
                  return 2
              elif str == "S":
                  return 5
          elif state == 5:
              if str == "N":
                  return 4
              elif str == "E":
                  return 3
              elif str == "W":
                  return 2
              elif str == "S":
                  return 1
  
  
  dice = Dice(n)
  status = 0
  
  for i in range(len(s)):
      status = dice.move(s[i], status)
  
  print(n[status])
  
problem_description: Dice I
  
    
  
  Write a program to simulate rolling a dice, which can be constructed by the
  following net.
  
    
  ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ITP1_11_A_1)  
  ![](https://judgeapi.u-aizu.ac.jp/resources/images/IMAGE2_ITP1_11_A_2)  
    
    
  
  As shown in the figures, each face is identified by a different label from 1
  to 6.
  
  Write a program which reads integers assigned to each face identified by the
  label and a sequence of commands to roll the dice, and prints the integer on
  the top face. At the initial state, the dice is located as shown in the above
  figures.
samples: [{"input": "1 2 4 8 16 32\n    SE", "output": "8\n    \n\nYou are given a dice where 1, 2, 4, 8, 16 are 32 are assigned to a face\nlabeled by 1, 2, ..., 6 respectively. After you roll the dice to the direction\nS and then to the direction E, you can see 8 on the top face."}, {"input": "1 2 4 8 16 32\n    EESWN", "output": "32"}]