def LI():return [int(i) for i in input().split()] ans=1 n,m,x=LI() a=LI() b=LI() fl=False if n==1 or m==1: 0/0