output_description: Print the number of days for which the forecast was correct.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
      T
attempt: import sys
  from collections import deque
  
  input = sys.stdin.readline
  
  n = int(input())
  a = [deque([x for x in list(map(int, input().split()))]) for _ in range(n)]
  
  f = True
  day = 1
  while f:
      if day > 2500:
          print(-1)
          sys.exit()
      done = set()
      nokori_games = 0
  
      for m in range(n):
          la = len(a[m])
          nokori_games += la
          if m in done:
              pass
          elif la:
              teki = a[m][0]
              jibun = m + 1
              if a[teki - 1][0] == jibun and teki - 1 not in done:
                  a[m].popleft()
                  a[teki - 1].popleft()
                  done.add(m)
                  done.add(teki - 1)
                  nokori_games -= 1
              elif not len(a[teki - 1]):
                  print(-1)
                  sys.exit()
      if nokori_games:
          if not len(done):
              print(-1)
              sys.exit()
      else:
          print(day)
          sys.exit()
      day += 1
  
problem_description: Statement
  
  You will be given a string S of length 3 representing the weather forecast for
  three days in the past.
  
  The i-th character (1 \leq i \leq 3) of S represents the forecast for the i-th
  day. `S`, `C`, and `R` stand for sunny, cloudy, and rainy, respectively.
  
  You will also be given a string T of length 3 representing the actual weather
  on those three days.
  
  The i-th character (1 \leq i \leq 3) of S represents the actual weather on the
  i-th day. `S`, `C`, and `R` stand for sunny, cloudy, and rainy, respectively.
  
  Print the number of days for which the forecast was correct.
samples: [{"input": "CSS\n    CSR", "output": "2\n    \n\n  * For the first day, it was forecast to be cloudy, and it was indeed cloudy.\n  * For the second day, it was forecast to be sunny, and it was indeed sunny.\n  * For the third day, it was forecast to be sunny, but it was rainy.\n\nThus, the forecast was correct for two days in this case.\n\n* * *"}, {"input": "SSR\n    SSR", "output": "3\n    \n\n* * *"}, {"input": "RRR\n    SSS", "output": "0"}]