output_description: Print `Heisei` if the date represented by S is not later than April 30, 2019,
  and print `TBD` otherwise.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: import bisect
  import itertools
  
  a, b, q = map(int, input().split())
  ss, tt = [], []
  for _ in range(a):
      ss.append(int(input()))
  for _ in range(b):
      tt.append(int(input()))
  
  for _ in range(q):
      x = int(input())
      md = pow(10, 15)
      xs, xt = bisect.bisect_left(ss, x), bisect.bisect_left(tt, x)
      ls, rs, lt, rt = (
          ss[max(0, xs - 1)],
          ss[min(a - 1, xs)],
          tt[max(0, xt - 1)],
          tt[min(b - 1, xt)],
      )
      for s, t in itertools.product([ls, rs], [lt, rt]):
          if s > t:
              if t > x:
                  md = s - x if s - x < md else md
              elif s > x:
                  if md > 2 * (s - x) + x - t:
                      md = 2 * (s - x) + x - t
                  if md > 2 * (x - t) + s - x:
                      md = 2 * (x - t) + s - x
              else:
                  md = x - t if x - t < md else md
          else:  # t > s
              if s > x:
                  md = t - x if t - x < md else md
              elif t > x:
                  if md > 2 * (x - s) + t - x:
                      md = 2 * (x - s) + t - x
                  if md > 2 * (t - x) + x - s:
                      md = 2 * (t - x) + x - s
              else:
                  md = x - s if x - s < md else md
      print(md)
  
problem_description: Statement
  
  You are given a string S as input. This represents a valid date in the year
  2019 in the `yyyy/mm/dd` format. (For example, April 30, 2019 is represented
  as `2019/04/30`.)
  
  Write a program that prints `Heisei` if the date represented by S is not later
  than April 30, 2019, and prints `TBD` otherwise.
samples: [{"input": "2019/04/30", "output": "Heisei\n    \n\n* * *"}, {"input": "2019/11/01", "output": "TBD"}]