You are given a set $\mbox{A}$ and $n$ other sets. 

Your job is to find whether set $\mbox{A}$ is a strict superset of each of the $N$ sets.   

Print True, if $\mbox{A}$ is a strict superset of each of the $N$ sets. Otherwise, print False. 

A strict superset has at least one element that does not exist in its subset.  

Example 

Set$([1,3,4])$ is a strict superset of set$([1,3])$. 

Set$([1,3,4])$ is not a strict superset of set$([1,3,4])$. 

Set$([1,3,4])$ is not a strict superset of set$([1,3,5])$.  

Input Format

The first line contains the space separated elements of set $\mbox{A}$. 

The second line contains integer $n$, the number of other sets. 

The next $n$ lines contains the space separated elements of the other sets.  

Constraints

$0<len(set(A))<501$   
$0\lt N\lt21$  
$0<len(otherSets)<101$  

Output Format

Print True if set $\mbox{A}$ is a strict superset of all other $N$ sets. Otherwise, print False.

Sample Input 0
1 2 3 4 5 6 7 8 9 10 11 12 23 45 84 78
2
1 2 3 4 5
100 11 12

Sample Output 0
False

Explanation 0

Set $\mbox{A}$ is the strict superset of the set$([1,2,3,4,5])$ but not of the set$([100,11,12])$ because $\left(\begin{array}{c c}{{1}}&{{0}}&{{0}}\\ {{0}}&{{0}}&{{0}}\\ {{0}}&{{0}}&{{0}}&{{0}}\\ {{0}}&{{0}}&{{0}}&{{0}}\\ {{0}}&{{0}}&{{0}}&{{0}}\\ {{0}}&{{0}}&{{0}}&{{0}}\\ {{0}}&{{0}}&{{0}}&{{0}}\\ \end{array}\right).$ is not in set $\mbox{A}$. 

Hence, the output is False.

Source: hackerrank | Difficulty: EASY
Tags: Data structures


Solutions:
A = set(list(map(int, input().split())))
N = int(input())
result = 1
for i in range(N):
	B = set(list(map(int, input().split())))
	result *= 1 if B.intersection(A) == B and len(B) < len(A) else 0
print(bool(result))


a_set = set(input().strip().split())
n = int(input())
res = True
while n > 0 and res:
	n -= 1
	inp = set(input().strip().split())
	if len(inp) >= len(a_set):
		res = False
		break
	for i in inp:
		if not i in a_set:
			res = False
			break
print(res)


A = set(input().split())
N = int(input())
sub = [set(input().split()) for i in range(N)]
test = [0 if x.issubset(A) else 1 for x in sub]
print(sum(test) == 0)


A = set([int(x) for x in input().split()])
n = int(input())
out = True
for i in range(0, n):
	B = set([int(x) for x in input().split()])
	if len(B - A) != 0 or len(A - B) == 0:
		out = False
print(out)


A = set(input().split())
result = True
for i in range(int(input())):
	B = set(input().split())
	if not A.issuperset(B) or A == B:
		result = False
print(result)


superset = set(input().split())
a = True
for i in range(int(input())):
	subset = set(input().split())
	if not subset <= superset or superset == subset:
		a = False
		break
print('True' if a else 'False')


A = set(input().split())
n = int(input())
S = []
for i in range(n):
	s = set(input().split())
	S.append(s)
res = all(map(lambda s: A.issuperset(s) and len(A) > len(s), S))
print(res)


flag = []
A = set(map(int, input().split()))
for i in range(int(input())):
	B = set(map(int, input().split()))
	if len(B) < len(A):
		flag.append(A.issuperset(B))
if False in flag:
	print('False')
else:
	print('True')


a = set([int(x) for x in input().split()])
(f, T) = ([], int(input()))
for _ in range(T):
	x = set([int(x) for x in input().split()])
	f.append(len(x) == len(a & x))
print(all(f))


A = set(map(int, input().strip().split()))
N = int(input())
sets = [set(map(int, input().strip().split())) for i in range(N)]
print('True' if len([1 for s in sets if s.issubset(A)]) == N else 'False')


a = set(map(int, input().split()))
n = int(input())
res = []
for i in range(n):
	line = set(map(int, input().split()))
	res.append(a.issuperset(line))
if sum(res) == len(res):
	print(True)
else:
	print(False)


A = set(map(int, input().split()))
n = int(input())
list = []
flag = 1
for i in range(n):
	list.append(set(map(int, input().split())))
for i in range(n):
	if list[i] <= A and len(A) > len(list[i]):
		continue
	else:
		flag = 0
		print(False)
		break
if flag == 1:
	print(True)


A = set(map(int, input().split()))
result = True
for _ in range(int(input())):
	N = set(map(int, input().split()))
	result = result and (A & N == N and A != N)
print(result)


s = input().split()
n = int(input())
c = 0
for i in range(n):
	ss = input().split()
	if len(set(ss) - set(s)) > 0:
		c += 1
if c == 0:
	print('True')
else:
	print('False')


st = set([int(i) for i in input().split()])
inp = int(input())
for i in range(inp):
	ss = set([int(i) for i in input().split()])
	if not st.issuperset(ss):
		print('False')
		break
	if i == inp - 1:
		print('True')


ints = lambda : set(map(int, input().split()))
A = ints()
print(all((A >= ints() for i in range(int(input())))))


a = set((int(i) for i in input().split(' ')))
b = int(input())
l = []
result = []
for i in range(b):
	el = set((int(i) for i in input().split(' ')))
	l.append(el)
for i in l:
	if len(a - i) > 0 and len(i - a) == 0:
		result.append(True)
	else:
		result.append(False)
print(True) if all(result) else print(False)


def issuperset(S, s):
	return s <= S and S | s != s
S = set(map(int, input().split()))
N = int(input())
print(all((issuperset(S, set(map(int, input().split()))) for _ in range(N))))


def f2(s, t):
	if len(t) < len(s):
		for i in t:
			if i not in s:
				return False
		else:
			return True
	else:
		return False

def f1():
	s = set(map(int, input().split(' ')))
	b = True
	for _ in range(int(input())):
		t = set(map(int, input().split(' ')))
		b = b and f2(s, t)
	print(b)
f1()


S = set(map(int, input().split()))

def test():
	for _ in range(int(input())):
		if S > set(map(int, input().split())):
			continue
		else:
			return False
	return True
print(test())


A = set(input().split())
for _ in range(int(input())):
	B = set(input().split())
	if not B < A:
		print(False)
		raise SystemExit
print(True)


A = set(map(int, input().split()))
ans = 'True'
for _ in range(int(input())):
	B = set(map(int, input().split()))
	if B.difference(A.intersection(B)) or not A.difference(B):
		ans = 'False'
		break
print(ans)


(A, N) = (set(input().split()), int(input()))
result = 'True'
for i in range(N):
	S = set(input().split())
	if not (S.issubset(A) and len(A) > len(S)):
		result = 'False'
		break
print(result)


A = set(input().split())
otherset_list = [set(input().split()) for i in range(int(input()))]
answer_list = [(i <= A) & (i != A) for i in otherset_list]
print(all(answer_list))


A = set(input().split())
n = int(input())
listofNset = []
ans = True
for i in range(n):
	S = set(input().split())
	if len(S - A) == 0 and A != S:
		ans = ans and True
	else:
		ans = ans and False
print(ans)


s = set(input().split())
result = True
for _ in range(int(input())):
	result = result and s > set(input().split())
print(result)


aa = {int(i) for i in input().split()}
N = int(input())
t = True
for i in range(N):
	tmpSet = {int(i) for i in input().split()}
	if tmpSet.issubset(aa) and (not tmpSet.issuperset(aa)):
		t = True
	else:
		t = False
		break
print(t)


A = set(input().split())
N = int(input())
isStrick = True
for i in range(N):
	B = set(input().split())
	isStrick = isStrick if A.issuperset(B) and A != B else False
print(isStrick)


a = set(input().split())
b = []
for i in range(int(input())):
	b.append(set(input().split()))
print(all((len(a) >= len(i) and len(a.union(i)) == len(a) for i in b)))


A = set(map(int, input().split(' ')))
N = int(input())
for i in range(N):
	B = set(map(int, input().split(' ')))
	if not A.issuperset(B) and len(A) > len(B):
		print('False')
		break
else:
	print('True')


st = set(map(int, input().split()))
n = int(input())
results = set()
for i in range(0, n):
	o = set(map(int, input().split()))
	results.add(o.intersection(st) == o and len(st.difference(o)) != 0)
if len(results) == 1 and True in results:
	print('True')
else:
	print('False')


a = set(map(int, input().split()))
flag = 1
for i in range(int(input())):
	x = set(map(int, input().split()))
	if a > x:
		continue
	else:
		flag = 0
		print('False')
		break
if flag == 1:
	print('True')


B = set(input().split())
ans = True
for _ in range(int(input())):
	A = set(input().split())
	if A.difference(B) == set():
		if set(A) == set(B):
			ans = False
			break
	else:
		ans = False
		break
print(ans)


l = set(map(int, input().split()))
n = int(input())
s = set()
for _ in range(n):
	s |= set(map(int, input().split()))
print(l & s == s)


s = {int(x) for x in input().split()}
n = int(input())
isSuper = True
for line in range(n):
	line = {int(x) for x in input().split()}
	if line - s == set() and s - line != set():
		continue
	else:
		isSuper = False
		break
print(isSuper)


set_a = set([int(x) for x in input().split()])
is_superset = True
for _ in range(int(input())):
	other_set = set([int(x) for x in input().split()])
	is_superset = is_superset and (set_a.issuperset(other_set) and set_a != other_set)
print(is_superset)


A = set(input().split())
checks = []
for i in range(int(input())):
	B = set(input().split())
	if A.issuperset(B):
		checks.append(True)
	else:
		checks.append(False)
if all(checks):
	print(True)
else:
	print(False)


A = set(map(int, input().split()))
for _ in range(int(input())):
	if not set(map(int, input().split())) <= A:
		print('False')
		break
else:
	print('True')


a = set(map(int, input().split()))
for i in range(int(input())):
	b = set(map(int, input().split()))
	flag = a | b == a
	if not flag:
		break
print(flag)


A = set(input().split())
I = [set(input().split()) for _ in range(int(input()))]
q = [(x <= A) & (x != A) for x in I]
print(all(q))


SS = set(input().split())
m = int(input())
for i in range(m):
	st = set(input().split())
	if len(SS.difference(st)) == 0 or len(st.difference(SS)) > 0:
		print('False')
		break
else:
	print('True')


s = set(map(int, input().split()))
n = int(input())
superset = False
for i in range(n):
	if s.issuperset(set(map(int, input().split()))):
		superset = True
	else:
		superset = False
		break
print(superset)


def isstrictsuperset(a, b):
	return b.issubset(a) and (not a.issubset(b))
a = set((int(x) for x in input().split(' ')))
n = int(input())
res = True
for _ in range(n):
	b = set((int(x) for x in input().split(' ')))
	res &= isstrictsuperset(a, b)
print(res)


A = set(map(int, input().split()))
length = len(A)
N = int(input())
var = 1
for i in range(N):
	B = set(map(int, input().split()))
	if (length > len(B)) & A.issuperset(B):
		var = 1
	else:
		var = 0
		break
if var == 0:
	print('False')
else:
	print('True')


A = set(map(int, input().split()))
super_set = True
for _ in range(int(input())):
	other_set = set(map(int, input().split()))
	if not A.issuperset(other_set):
		super_set = False
print(super_set)


def f():
	a = set(input().split())
	n = int(input())
	for _ in range(n):
		b = set(input().split())
		if not b.issubset(a) or len(a - b) == 0:
			return False
	return True
print(f())


def __starting_point():
	A = set(map(int, input().strip().split(' ')))
	t = int(input().strip())
	superset = True
	for _ in range(t):
		subset = set(map(int, input().strip().split(' ')))
		if len(subset - A) != 0 or len(A - subset) == 0:
			superset = False
			break
	print(superset)
__starting_point()


a = set(map(int, input().split()))
n = int(input())
result = True
for i in range(n):
	b = set(map(int, input().split()))
	result &= a > b
print(result)


A = set(map(int, input().split()))
t = int(input())
is_strict = True
for _ in range(t):
	B = set(map(int, input().split()))
	if A.issuperset(B) != True or len(A) == len(B):
		print(False)
		break
else:
	print(True)


s = set([x for x in input().split()])
res = True
for i in range(int(input())):
	res &= set([x for x in input().split()]).issubset(s)
print(res)


A = set(map(int, input().split()))
N = int(input())
superset = True
while N > 0:
	N -= 1
	B = set(map(int, input().split()))
	if not B.issubset(A):
		superset = False
		break
print(superset and len(A) > 0)


a = set(map(int, input().split()))
n = int(input())
check = True
for _ in range(n):
	s = set(map(int, input().split()))
	if not (a.issuperset(s) and len(a) > len(s)):
		check = False
print(check)


import sys
master = set(map(int, input().split()))
num = int(input())
for x in range(num):
	tmp = set(map(int, input().split()))
	if not tmp.issubset(master):
		print(False)
		sys.exit(0)
print(True)


A = set(map(int, input().split()))
numsubs = int(input())
superset = True
for sub in range(numsubs):
	subset = set()
	for item in input().split():
		subset.add(int(item))
	Adiff = A.difference(subset)
	Bdiff = subset.difference(A)
	if len(Adiff) == 0 or len(Bdiff) > 0:
		superset = False
		break
print(superset)


A = set(map(int, input().split()))
isset = True
for _ in range(int(input())):
	B = set(map(int, input().split()))
	if not (A != B and A.issuperset(B)):
		isset = False
		break
print(isset)


superSet = set(map(int, input().split()))
numSet = int(input())
isStrictSuperSet = True
for i in range(0, numSet):
	subset = set(map(int, input().split()))
	isStrictSuperSet = superSet.issuperset(subset)
	if not isStrictSuperSet:
		break
if isStrictSuperSet:
	print('True')
else:
	print('False')


A = set(map(int, input().split()))
n = int(input())
res = 'False'
for i in range(n):
	B = set(map(int, input().split()))
	v = len(B - A)
	if v != 0:
		res = 'False'
		break
	else:
		res = len(B - A) == 0
print(res)


a = set(map(int, input().strip().split(' ')))
n = int(input())

def f():
	for i in range(n):
		b = set(map(int, input().strip().split(' ')))
		if not a > b:
			return False
	return True
print(f())


a = set(input().split(' '))
n = int(input())
arr = []
for i in range(0, n):
	arr.append(input())
var = True
for i in range(0, n):
	b = set(arr[i].split(' '))
	if a.issuperset(b) != True or len(a) <= len(b):
		var = False
		break
print(var)


A = set(input().split())
n = int(input())
check = True
for i in range(n):
	s = set(input().split())
	if s & A != s or s == A:
		check = False
		break
print(check)


A = set(map(int, input().strip().split()))
N = int(input().strip())
other_sets = [set(map(int, input().split())) for _ in range(N)]

def is_strict_superset(A, other_set):
	return len(A - other_set) > 0 and len(other_set - A) == 0
set_comparisons = [is_strict_superset(A, other_set) for other_set in other_sets]
print(all(set_comparisons))


A = set(map(int, input().strip().split()))
n = int(input())
res = True
for _ in range(0, n):
	B = set(map(int, input().strip().split()))
	if A & B != B or len(A) <= len(B):
		res = False
		break
print(res)


a = set(input().split())
n = int(input())
for _ in range(n):
	b = set(input().split())
	if not b.issubset(a) or len(a) < len(b):
		print(False)
		break
else:
	print(True)


ok = True
s = set(input().split())
for _ in range(int(input())):
	n = set(input().split())
	if not s > n:
		print(False)
		ok = False
		break
if ok:
	print(True)


li = set(map(int, input().split()))
m = int(input())
flag = 1
for i in range(m):
	other = set(map(int, input().split()))
	if li > other:
		continue
	else:
		flag = 0
		print('False')
		break
if flag == 1:
	print('True')


A = set(map(int, input().split()))
N = int(input())
found = True
for i in range(0, N):
	s = set(map(int, input().split()))
	if s == A or s | A != A:
		found = False
		break
	else:
		pass
print(found)


a = set(input().split())
ok = True
for _ in range(int(input())):
	b = set(input().split())
	if not a > b:
		ok = False
		break
print(ok)


A = set(map(int, input().split()))
for _ in range(int(input())):
	X = set(map(int, input().split()))
	if A.issuperset(X) != True or len(A) == len(X):
		print(False)
		break
else:
	print(True)


l = set(input().split())
n = int(input())
c = 0
for i in range(n):
	s = set(input().split())
	if s - l:
		c += 0
	else:
		c += 1
if c == n:
	print(True)
else:
	print(False)


A = set(input().split(' '))
for i in range(int(input())):
	B = set(input().split(' '))
	if (len(A.difference(B)) != 0) & (len(B.difference(A)) == 0):
		Superset = True
	else:
		Superset = False
		break
print(Superset)


s1 = set(input().split())
x = 0
for i in range(int(input())):
	s2 = set(input().split())
	if s1.issuperset(s2):
		s2 = {}
	else:
		x = 1
if x == 1:
	print('False')
else:
	print('True')


a = set(map(int, input().split()))
n = int(input())
superset = True
for _ in range(n):
	b = set(map(int, input().split()))
	if len(b - a) != 0 or len(a - b) == 0:
		superset = False
		break
print(superset)


a = set([int(i) for i in input().split()])
n = int(input())
d = True
for i in range(n):
	b = set([int(i) for i in input().split()])
	if not a.issuperset(b):
		d = False
print(d)


A = set(map(int, input().split()))
N = int(input())
result = True
for i in range(N):
	if not A.issuperset(set(map(int, input().split()))):
		result = False
		break
print(result)


S = set(map(int, input().split()))
x = int(input())
flag = 'True'
for i in range(x):
	A = set(map(int, input().split()))
	if len(A - S) > 0:
		flag = 'False'
		break
print(flag)


A = set(map(int, input().split()))
n = int(input())
ctr = 0
for i in range(n):
	b = set(map(int, input().split()))
	if b < A:
		ctr += 1
if ctr == n:
	print(True)
else:
	print(False)


bol = True
a = set([int(j) for j in input().split(' ')])
for i in range(int(input())):
	b = set([int(j) for j in input().split(' ')])
	if a > b:
		continue
	else:
		bol = False
		break
print(bol)


A = set(map(int, input().split()))
N = int(input())
result = True
for _ in range(N):
	B = set(map(int, input().split()))
	if len(A) <= len(B) or len(B) != len(B.intersection(A)):
		result = False
		break
print(result)


a = set(map(int, input().split()))
for i in range(int(input())):
	other = set(map(int, input().split()))
	diff = other.difference(a)
	is_superset = (len(diff) == 0) & (len(a) != len(other))
	if not is_superset:
		break
print(is_superset)


list1 = map(int, input().split())
N = int(input())
keyset = set(list1)
score = 0

def issuperset(tempkeyset):
	if tempkeyset.union(keyset) == keyset and len(tempkeyset.intersection(keyset)) >= 1:
		return 1
	else:
		return 0
for i in range(0, N):
	list2 = map(int, input().split())
	score = score + issuperset(set(list2))
print(score == N)


a = set(map(int, input().split()))
out = 'True'
for x in range(int(input())):
	tmp = set(map(int, input().split()))
	if not (tmp < a and len(tmp) < len(a)):
		out = 'False'
print(out)


s = set(input().split())
n = int(input())
a = True
for i in range(n):
	x = set(input().split())
	a = a & (s.issuperset(x) and len(s) > len(x))
print(a)


a = set(map(int, input().split()))
b = int(input())
result = True
for i in range(b):
	c = set(map(int, input().split()))
	result = result and a.issuperset(c) and (len(a) > len(c))
print(result)


s = set(input().split())
out = True
for i in range(int(input())):
	l = set(input().split())
	out = len(l.difference(s)) == 0 and len(s.difference(l)) != 0
	if out == False:
		print(out)
		break
else:
	print(True)


A = set(str(input()).split())
N = int(input())
ans = True
for i in range(N):
	B = set(str(input()).split())
	ans = len(B - A) == 0 and len(A) != len(B)
	if ans is False:
		break
print(ans)


A = set(input().split())
ok = True
for i in range(int(input())):
	B = set(input().split())
	if not A.issuperset(B) or A == B:
		ok = False
print(ok)


A = set(map(int, input().split()))
n = int(input())
l = list()
for x in range(n):
	l.append(set(map(int, input().split())))
b = True
for s in l:
	if s.issubset(A) != True:
		b = False
print(b)


__author__ = 'namii'
A = set(input().split())
result = True
for _ in range(int(input())):
	B = set(input().split())
	if not (A.issuperset(B) and len(A) > len(B)):
		result = False
		break
print(result)


A = set(input().split())
a = int(input())
for i in range(a):
	B = set(input().split())
	if A.intersection(B) != B or len(A) == len(B):
		print(False)
		break
	elif i + 1 == a:
		print(True)


import sys
A = set(input().split())
n = int(input())
for _ in range(n):
	B = set(input().split())
	if B - A or len(A) == len(B):
		print('False')
		sys.exit(0)
print('True')


s = set(map(int, input().split()))
r = True
for _ in range(int(input())):
	if len(set(map(int, input().split())).difference(s)) != 0:
		r = False
print(r)


def is_strict_superset(A, N):
	for n in range(N):
		B = set(map(int, input().split()))
		if not (B != A and A.union(B) == A):
			return False
	return True
A = set(map(int, input().split()))
print(is_strict_superset(A, int(input())))


A = set(input().strip().split())
a = len(A)
found = False
for _ in range(int(input())):
	S = set(input().strip().split())
	if S.intersection(A) != S or a <= len(S):
		found = True
		break
if found:
	print(False)
else:
	print(True)


A = set(input().split())
mbool = False
for _ in range(int(input())):
	if A.issuperset(set(input().split())):
		mbool = True
	else:
		mbool = False
		break
print(mbool)


A = set(input().split())
flag = 1
for i in range(int(input())):
	B = set(input().split())
	if A.intersection(B) == B and A != B:
		flag *= 1
	else:
		flag *= 0
if flag == 0:
	print(False)
else:
	print(True)


s = set(map(int, input().split()))
for _ in range(int(input())):
	if not s > set(map(int, input().split())):
		print(False)
		exit(0)
print(True)


def read_int():
	return int(input())

def read_int_words():
	return map(int, input().split())
a = set(read_int_words())
n = read_int()
out = True
for i in range(n):
	s = set(read_int_words())
	out &= a.intersection(s) == s and a != s
print(out)


s = set(input().split())
ans = True
for i in range(int(input())):
	t = set(input().split())
	if (s > t) == False:
		ans = False
		break
print(ans)


A = set(input().split())
n = int(input())
res = True
for _ in range(n):
	B = set(input().split())
	res &= A > B
print(res)