package main import . "fmt" func main() { var n int var s,t string Scan(&n,&s,&t) b:=make([]int,len(t)) const K int =2e5 for i:=K;i>=0;i-- { c:=(i*len(s))%len(t) b[c]=i } for ;n>0;n-- { var a int Scan(&a) x:=a/len(s) y:=a-x*len(s) m:=y%len(t) if m!=0 { x-=b[len(t)-m] if x<0 { x=0 } y=a-x*len(s) } y/=len(t) f:=false for ;x>0;x-- { if f { Print(" ") } f=true Print(s) } for ;y>0;y-- { if f { Print(" ") } f=true Print(t) } Println() } }