#include <iostream>
#include <vector>
#include <queue>
using namespace std;

void solve() {
  int N, c1, g1, c2, g2;
  cin >> N >> c1 >> g1 >> c2 >> g2;
  long long limit = N + 47;
  if (g1 >= c1 && g2 >= c2) limit = N + c1 + c2 + 47;
  if (g1 >= c1 && g2 < c2) limit = N + 1ll * (g1-c1) * (c2-g2) + g1 + g2 + c1 + c2 + 47;
  if (g1 < c1 && g2 >= c2) limit = N + 1ll * (c1-g1) * (g2-c2) + g1 + g2 + c1 + c2 + 47;
  if (limit < 1234567) limit = 1234567;
  if (limit > N + 123456789) limit = N + 123456789;
  vector<bool> visited(limit,false);
  queue<int> Q;
  visited[N] = true;
  Q.push(N);
  while (!Q.empty()) {
    int where = Q.front(); Q.pop();
    if (where >= c1) {
      int next = where - c1;
      if (next) next += g1;
      if (next<limit && !visited[next]) { visited[next]=true; Q.push(next); }
    }
    if (where >= c2) {
      int next = where - c2;
      if (next) next += g2;
      if (next<limit && !visited[next]) { visited[next]=true; Q.push(next); }
    }
  }
  if (visited[0]) cout << "PRINCE" << endl;
  else if (c1>0 && visited[c1-1]) cout << "DRAW" << endl;
  else if (c2>0 && visited[c2-1]) cout << "DRAW" << endl;
  else cout << "DRAGON" << endl;
}

int main() { int T; cin >> T; while (T--) solve(); }

