package main import ( "bufio" "fmt" "log" "os" "strconv" ) func main() { log.SetFlags(log.Lshortfile) // log.Println("hello") sc := newScanner() N := sc.nextInt() A := make([]string, N) for i := 0; i < N; i++ { A[i] = sc.nextLine() } M := sc.nextInt() B := make([]string, M) for i := 0; i < M; i++ { B[i] = sc.nextLine() } As := make([]string, 0) var bfs func(string, int, uint) bfs = func(s string, c int, used uint) { if c == N { As = append(As, s) return } for i := range A { u := uint(i) // log.Println(used, 1< 10000 { break } cnt++ } } log.Println(ans) if len(ans) == 1 { fmt.Println(ans) } else { fmt.Println("-1") } } type scanner struct { r *bufio.Reader buf []byte p int } func newScanner() *scanner { rdr := bufio.NewReaderSize(os.Stdin, 1000) return &scanner{r: rdr} } func (s *scanner) next() string { s.pre() start := s.p for ; s.p < len(s.buf); s.p++ { if s.buf[s.p] == ' ' { break } } result := string(s.buf[start:s.p]) s.p++ return result } func (s *scanner) nextLine() string { s.pre() start := s.p s.p = len(s.buf) return string(s.buf[start:]) } func (s *scanner) nextInt() int { v, _ := strconv.Atoi(s.next()) return v } func (s *scanner) pre() { if s.p >= len(s.buf) { s.readLine() s.p = 0 } } func (s *scanner) readLine() { s.buf = make([]byte, 0) for { l, p, e := s.r.ReadLine() if e != nil { panic(e) } s.buf = append(s.buf, l...) if !p { break } } }