char*p;main(j,s){for(;p&&*p||gets(p=s,j=2);*p%p[-j/2]||putchar(*p?:10))p=*++p?p:++j/2+s;}