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: N = int(input())
  A = []
  c = 0
  f = True
  for i in range(N):
      A.append(list(map(int, input().split())))
  idx = [0 for i in range(N)]
  
  a = 0
  
  cc = 0
  
  ccc = 0
  
  btlf = [False for i in range(N)]  # その周回ですでにバトルしたかどうかのフラグです
  m = (N * (N - 1)) // 2
  n = 100000
  for i in range(min(m, n)):  # 周回
      btlf = [False for i in range(N)]  # リセット
      ccc = 0
      for j in range(N):
          # print(idx)
          if idx[j] != N - 1:
              a = A[j][idx[j]]
              if a > j:
                  if (
                      A[a - 1][idx[a - 1]] - 1 == j
                      and btlf[a - 1] == False
                      and btlf[j] == False
                  ):
                      idx[a - 1] += 1
                      btlf[a - 1] = True
                      idx[j] += 1
                      btlf[j] = True
                      cc += 1
                      ccc += 1
      if cc == m:  # idx == [N-1 for i in range(N)]:
          print(i + 1)
          f = False
          break
      if ccc == 0:  # 対戦が一度もなければ打ち切ります
          break
  if f:
      print(-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"}]