Buggy python submission (verdict: Runtime Error):
while(1):
  table, output = [], []
  table_number = input()
  string = ''
  for i in table_number:
    table.append(raw_input().split())
  string_number = input()
  for i in string_number:
    string = input()
    for table_element in table:
      if tabole_element[0] == string:
        string =table_element[1]
    output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table, output = [], []
  table_number = input()
  string = ''
  for i in table_number:
    table.append(raw_input().split())
  string_number = input()
  for i in string_number:
    string = input()
    for table_element in table:
      if tabole_element[0] == string:
        string =table_element[1]
    output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table, output = [], []
  table_number = input()
  string = ''
  if table_number == 0:
    break
  for i in table_number:
    table.append(raw_input().split())
  string_number = input()
  for i in string_number:
    string = input()
    for table_element in table:
      if tabole_element[0] == string:
        string =table_element[1]
    output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table = {}
  output = ''
  table_number = input()
  if table_number == 0:
    break
  for i in table_number:
    table.append(raw_input().split())
  string_number = input()
  for i in string_number:
    string = input()
    for table_element in table:
      if tabole_element[0] == string:
        string =table_element[1]
    output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table = {}
  output = ''
  table_number = input()
  if table_number == 0:
    break
  for i in table_number:
    table.append(raw_input().split())
  string_number = input()
  for i in string_number:
    string = input()
    for table_element in table:
      if tabole_element[0] == string:
        string =table_element[1]
    output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table = {}
  output = ''
  table_number = input()
  if table_number == 0:
    break
  for i in range(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = input()
  for i in (string_number):
    string = input()
    for table_element in table:
      if tabole_element[0] == string:
        string =table_element[1]
    output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table = {}
  output = ''
  table_number = input()
  if table_number == 0:
    break
  for i in range(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = input()
  for i in (string_number):
    string = input()
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in range(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in (string_number):
    string = input()
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in range(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in (string_number):
    string = input()
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Buggy python submission (verdict: Runtime Error):
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in range(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in (string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output

Fixed submission:
while(1):
  table = {}
  output = ''
  table_number = int(input())
  if table_number == 0:
    break
  for i in xrange(table_number):
    a, b = raw_input().split()
    table[a] = b
  string_number = int(input())
  for i in xrange(string_number):
    string = raw_input()[0]
    if string in table:
      output += table[string]
    else:
      output += string
  print output