#include <bits/stdc++.h>
using namespace std;
long long gcd(long long m, long long n) {
  long long temp = 0;
  if (m < n) {
    temp = m;
    m = n;
    n = temp;
  }
  while (n != 0) {
    temp = m % n;
    m = n;
    n = temp;
  }
  return m;
}
int main() {
  long long n, x, y;
  cin >> n >> x >> y;
  vector<long long> a;
  vector<int> ans(x + y, -1);
  vector<long long> xx(x);
  vector<long long> yy(y);
  for (int i = 0; i < x; i++) xx[i] = i + 1;
  for (int i = 0; i < y; i++) yy[i] = i + 1;
  for (int i = 0; i < n; i++) {
    long long t;
    cin >> t;
    t--;
    a.push_back(t);
  }
  long long lcm = (x * y) / gcd(x, y);
  for (int i = 0; i < x; i++) {
    xx[i] *= (lcm / x);
  }
  for (int i = 0; i < y; i++) {
    yy[i] *= (lcm / y);
  }
  int i = 0, j = 0;
  for (int k = 0; k < x + y; k++) {
    if (i >= x) {
      ans[k] = 1;
      j++;
    } else if (j >= y) {
      ans[k] = 0;
      i++;
    } else {
      if (xx[i] < yy[j]) {
        ans[k] = 0;
        i++;
      } else if (yy[j] < xx[i]) {
        ans[k] = 1;
        j++;
      } else {
        ans[k] = 2;
        ++k;
        ans[k] = 2;
        i++;
        j++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (ans[a[i] % (x + y)] == 0)
      cout << "Vanya" << endl;
    else if (ans[a[i] % (x + y)] == 1)
      cout << "Vova" << endl;
    else if (ans[a[i] % (x + y)] == 2)
      cout << "Both" << endl;
  }
  return 0;
}
