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<= 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 } } }