#include <bits/stdc++.h>
using namespace std;
char ans[5][10] = {{"Vanya"}, {"Vova"}, {"Both"}};
int len[2222222];
int gcd(int a, int b) {
  if (b > a) swap(a, b);
  if (b == 0) return a;
  gcd(b, a % b);
}
int main() {
  int n, x, y, i;
  scanf("%d%d%d", &n, &x, &y);
  int g = gcd(x, y);
  x = x / g;
  y = y / g;
  double contx = 1;
  double conty = 1;
  for (i = 0; i < x + y; i++)
    if (contx / double(x) > conty / double(y)) {
      len[i] = 1;
      conty++;
    } else if (contx / double(x) < conty / double(y)) {
      len[i] = 0;
      contx++;
    }
  len[x + y - 1] = 2;
  len[x + y - 2] = 2;
  for (i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    printf("%s\n", ans[len[(a - 1) % (x + y)]]);
  }
}
