'''
Name : Midathana Pavani
ID : N190336
Class : E-1(cse2)
Description : Python program for SET OPERATIONS
'''
def getAXB(a,b):
set_a = set()
for i in a:
for j in b:
set_a.add((i,j))
return set_a
def getlist(list_a,n):
list_b = list_a + [n]
return list_a,list_b
def subsets(a):
set_c = {tuple() , }
list_c = []
for i in a:
for tuple_a in set_c:
list_a , list_b = getlist(list(tuple_a) , i)
list_c.append(tuple(set(list_a)))
list_c.append(tuple(set(list_b)))
set_c.update(tuple(list_c))
print("Total no. of relations : " + str(len(set_c)))
print("They are : ")
for i in set_c:
print(str(j) + str(list(i)))
n = int(input("Enter no. of elements of 1st list: ")) #taking no. of elements in list A
a = list(map(int,input().split()))
print("Given list is : " + str(a))
m = int(input("Enter no. of elements of 2nd list: ")) #taking no. of elements in List B
b = list(map(int,input().split()))
print("Given list is : " + str(b))
set_a = getAXB(a,b)
print("AXB =" + str(set_a))
subsets(list(set_a))