#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

typedef pair<int,int> PII;

const int MAXN = 10005;
const int MAXQ = 1005;
const int MAXM = 100005;

int dfn[MAXN], low[MAXN], st[MAXN], top;

int n, m, Q;
vector<int> e[MAXN];
int s[MAXN];

int find(int x) {
	if (s[x] == x) return x;
	return s[x] = find(s[x]);
}

void merge(int x, int y) {
	x = find(x), y = find(y);
	x < y ? s[y] = x : s[x] = y;
}

void tarjan(int now, int cnt) {
	int part = (cnt > 1);
	st[top++] = now;
	dfn[now] = low[now] = cnt;
	for (int ii = e[now].size()-1; ii >= 0; --ii) {
		int i = e[now][ii];
		if (!dfn[i]) {
			tarjan(i, cnt+1);
			low[now] = min(low[now], low[i]);
			if (low[i] > dfn[now])
				merge(now, i);
		} else if (dfn[i] != dfn[now] - 1)
			low[now] = min(low[now], dfn[i]);
	}
}

int keyEdge(int N) {
	memset(dfn, 0, sizeof(dfn));
	memset(low, 0, sizeof(low));
	top = 0;
	for (int i = 1; i <= N; ++i)
		if (!dfn[i]) tarjan(i, 1);	
}

int main() {
	while (3==scanf("%d%d%d",&n,&m,&Q) && n) {
		for (int i = 1; i <= n; ++i) {
			e[i].clear();
			s[i] = i;
		}
		for (int x,y,i = 0; i < m; ++i) {
			scanf("%d%d", &x, &y);
			e[x].push_back(y);
			e[y].push_back(x);
		}
		keyEdge(n);
		for (int x,y,i = 0; i < Q; ++i) {
			scanf("%d%d", &x, &y);
			puts(find(x) == find(y) ? "Y" : "N");
		}
		puts("-");
	}
}
