#include<bits/stdc++.h> usingnamespace std; typedef bitset<8001> poly; template <classT> inlineintread(T &x){ x = 0; int c = getchar(), f = 1; for (; !isdigit(c); c = getchar()) if (c == 45) f = -1; for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0'); return x; } int lf, lg, lh, len, LOG[1<<16|1]; poly f, g, h, t, ans, pw[17], s[1<<16|1]; voidinit(){for (int i = 2; i <= (1<<16); i++) LOG[i] = LOG[i>>1]+1;} voidmod(poly &p, int l){ for (int i = l; i >= lh; i--) if (p[i]) p ^= (h<<(i-lh)); } poly mul(poly a, poly b){ poly ret = 0; for (int i = 0; i <= lh; i++) if (a[i]) ret ^= b<<i; mod(ret, 2*lh); return ret; } intgetsta(int l, int r){ int ret = 0; for (int i = l; i <= r; i++) ret |= f[i]<<(i-l); return ret; } intmain(){ read(lf); for (int i = 0, x; i <= lf; i++) if (read(x)) f.set(i); read(lg); for (int i = 0, x; i <= lg; i++) if (read(x)) g.set(i); read(lh); for (int i = 0, x; i <= lh; i++) if (read(x)) h.set(i); mod(g, lg), pw[0].set(0), s[1].set(0), t.set(0), init(); for (int i = 1; i <= 16; i++) pw[i] = mul(pw[i-1], g); for (int i = 2; i < (1<<16); i++) s[i] = s[i-(1<<LOG[i])]^pw[LOG[i]]; for (int i = 0; i <= lf; i += 16, t = mul(t, pw[16])) ans ^= mul(s[getsta(i, i+15)], t); for (len = lh; !ans[len] && len; len--) ; printf("%d ", len); for (int i = 0; i <= len; i++) printf("%d ", ans[i] ? 1 : 0); returnputs(""), 0; }