# -*- coding: utf-8 -*-
#!/usr/bin/python

import sys

def find_row_col(header):
	row_ind, column_ind = 0,0
	for no,field in enumerate(header.split('\t')):
		if '$s:row_base' in field:
			row_ind = no
		elif '$s:column_base' in field:
			column_ind = no
	return row_ind, column_ind



def main():
	header = sys.stdin.readline().strip()
	row_ind, col_ind = find_row_col(header)
	for line in sys.stdin:
		line = line.strip()
		if len(line):
			tokens = line.split('\t')
			print tokens[row_ind], tokens[col_ind]


if __name__ == '__main__':
	main()

