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: class Dice:
  
      def __init__(self, nums):
          self.__indexTop__ = 1
          self.__indexFront__ = 2
          self.__indexRight__ = 3
          self.__indexLeft__ = 4
          self.__indexBack__ = 5
          self.__indexBottom__ = 6
          self.__sides__ = {
              1: nums[0],
              2: nums[1],
              3: nums[2],
              4: nums[3],
              5: nums[4],
              6: nums[5],
          }
  
      def getTopSideNum(self):
          return self.__sides__[self.__indexTop__]
  
      def getTopsideIndex(self):
          return self.__indexTop__
  
      def roll(self, direction):
          initTop = self.__indexTop__
          initFront = self.__indexFront__
          initRight = self.__indexRight__
          initLeft = self.__indexLeft__
          initBack = self.__indexBack__
          initBottom = self.__indexBottom__
          if direction == "N":
              self.__indexTop__ = initFront
              self.__indexFront__ = initBottom
              self.__indexRight__ = initRight
              self.__indexLeft__ = initLeft
              self.__indexBack__ = initTop
              self.__indexBottom__ = initBack
          elif direction == "E":
              self.__indexTop__ = initLeft
              self.__indexFront__ = initFront
              self.__indexRight__ = initTop
              self.__indexLeft__ = initBottom
              self.__indexBack__ = initBack
              self.__indexBottom__ = initRight
          elif direction == "S":
              self.__indexTop__ = initBack
              self.__indexFront__ = initTop
              self.__indexRight__ = initRight
              self.__indexLeft__ = initLeft
              self.__indexBack__ = initBottom
              self.__indexBottom__ = initFront
          elif direction == "W":
              self.__indexTop__ = initRight
              self.__indexFront__ = initFront
              self.__indexRight__ = initBottom
              self.__indexLeft__ = initTop
              self.__indexBack__ = initBack
              self.__indexBottom__ = initLeft
  
  
  die = Dice([int(i) for i in input().split()])
  for direction in input():
      die.roll(direction)
  print(die.getTopSideNum())
  
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"}]