from __future__ import print_function
from sys import stdin

def printf(str, *args):
	print(str % args, end='')

domain = 10

def readfile(fn, adjacency, nocheck, n2):
	adjacencymx = [[0 for j in range(len(adjacency[0]))] for i in range(len(adjacency))]
	fp = open(fn, 'r')
	printf("%5cf%d={"%(' ',nocheck))
	lines = fp.readlines()
	i=0
	for line in lines:
		values = line.strip('\n').split()
		x = int(values[0])
		y = int(values[1])

		adjacencymx[x][y] = 1
		printf("%2c(%2d, %2d)" %(' ',x,y))
		i += 1
		if i>n2:
			break
	fp.close()
	return adjacencymx

adjacencymx = [[0 for j in range(domain+1)] for i in range(domain+1)]

fn = "pp3-1.dat"
fn2 = "pp3-2.dat"

nocheck = 1
n1 = 10
n2 = 10

adjacencymx = readfile(fn, adjacencymx,nocheck, n1)
printf("}\n\n")

define1=1

for i in range(1, domain+1):
	define2 = 0
	nocol = 0
	for j in range(1, domain+1):
		if adjacencymx[i][j] == 1:
			define2 = 1
			nocol += 1

	if define2 == 0:
		define1 = 0
		printf("%5cf%d is not function because" %(' ',nocheck))
		printf(" f(%d) is not defined.\n"%i)

	if nocol > 1:
		printf("%5cf%d is not function because" %(' ',nocheck))
		printf(" f(%d) is not unique image.\n"%i)

if define1 == 1:
	printf("%5cf%d is well-defined.\n\n"%(' ',nocheck))
nocheck += 1
printf("\n\n")
for i in range(1,domain+1):
	for j in range(1, domain+1):
		adjacencymx[i][j] = 0

adjacencymx = readfile(fn2, adjacencymx,nocheck, n2)
printf("}\n\n")

define1=1;

for i in range(1, domain+1):
	define2 = 0
	nocol = 0
	for j in range(1, domain+1):
		if adjacencymx[i][j] == 1:
			define2 = 1
			nocol += 1

	if define2 == 0:
		define1 = 0
		printf("%5cf%d is not function because" %(' ',nocheck))
		printf(" f(%d) is not defined.\n"%i)

	if nocol > 1:
		printf("%5cf%d is not function because" %(' ',nocheck))
		printf(" f(%d) is not unique image.\n"%i)

if define1 == 1:
	printf("%5cf%d is well-defined.\n\n"%(' ',nocheck))

stdin.readline()