gets;a=[*?0..?9];(s=$_.split;a=$_[11]?a&s: a-s)while gets;puts a