main=interact$f.lines f[x,y]=unlines[do c<-x;'(':a:b:c:")"|b<-y,a<-x]