据说这个东西是叫做(Multi-SG)……
不管叫什么反正直接暴力把SG给打出来就好了……
//minamoto
#include<bits/stdc++.h>
#define R register int
#define fp(i,a,b) for(R i=a,I=b+1;i<I;++i)
#define fd(i,a,b) for(R i=a,I=b-1;i>I;--i)
using namespace std;
char buf[1<<21],*p1=buf,*p2=buf;
inline char getc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}
int read(){
R res,f=1;char ch;
while((ch=getc())>'9'||ch<'0')(ch=='-')&&(f=-1);
for(res=ch-'0';(ch=getc())>='0'&&ch<='9';res=res*10+ch-'0');
return res*f;
}
const int N=1005;
int c,z,n,m,SG[N];bool vis[N];
int main(){
// freopen("testdata.in","r",stdin);
c=read(),z=read(),n=read();
fp(i,1,1000){
memset(vis,0,sizeof(vis));
fp(j,0,i-c)vis[SG[j]^SG[i-c-j]]=1;
fp(j,0,i-z)vis[SG[j]^SG[i-z-j]]=1;
fp(j,0,i-n)vis[SG[j]^SG[i-n-j]]=1;
fp(j,0,N)if(!vis[j]){SG[i]=j;break;}
}m=read();while(m--)puts(SG[read()]?"1":"2");return 0;
}