7 7 7
1
2
3
4
5
6
7
 4 2 8
1
3
4
2
3
4
1
2
 9 4 9
1
2
3
4
5
6
7
8
9
 7 5 7
1
2
3
4
5
6
7
 15 10 15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 4 0 4
1
2
3
4
 12 2 12
1
2
3
4
5
6
7
8
9
10
11
12
 10 2 10
1
2
3
4
5
6
7
8
9
10
 7 4 7
1
2
3
4
5
6
7
 7 3 7
1
2
3
4
5
6
7

XXXXXXX
 ..XX.X.X
 ...X.X.XX
 .X.XXXX
 .X.X.X.X.XXXXXX
 ....
 .........X.X
 .......X.X
 .X.X.XX
 ...X.XX

#include <stdio.h>

__int64 gcd(__int64 a, __int64 b)
{
	if(a % b == 0) return b;
	else return gcd(b, a%b);
}

int main(void)
{
	int i, m;
	__int64 n, k, slot, GCD, val;

	scanf("%I64d %I64d %d", &n, &k, &m);

	if(k == 0)
	{
		for(i = 0; i < m; i++)
		{
			scanf("%I64d", &slot);
			printf(".");
		}
		printf("\n");
		return 0;
	}		
		
	GCD = gcd(n, k);

	for(i = 0; i < m; i++)
	{
		scanf("%I64d", &slot);
		
		val = (slot % (n/GCD));
		if(val == 0) val = (n/GCD);

		if(val <= (n/GCD - k/GCD)) printf(".");
		else printf("X");
	}
	printf("\n");

	return 0;
}