Problem: Your task is the exact same as for the easy version. But this time, the marmots subtract the village's population P from their random number before responding to Heidi's request.

Also, there are now villages with as few as a single inhabitant, meaning that <image>.

Can you help Heidi find out whether a village follows a Poisson or a uniform distribution?

Input

Same as for the easy and medium versions. But remember that now 1 ≤ P ≤ 1000 and that the marmots may provide positive as well as negative integers.

Output

Output one line per village, in the same order as provided in the input. The village's line shall state poisson if the village's distribution is of the Poisson type, and uniform if the answers came from a uniform distribution.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int t;
int a[257];
long double hfahuwef[3007];
long double calc(int p, int k) {
  if (k == 0) return -p;
  return k * log(p) - p - hfahuwef[k];
}
long double poisson(int p) {
  long double res = 0;
  for (int i = 0; i < 250; ++i) {
    res += calc(p, a[i] + p);
  }
  return res;
}
long double uniform(int p) {
  long double res = 0;
  if (a[0] + p > 2 * p || a[249] + p < 0) return -1e9;
  return 250 * log(double(1) / (2 * p + 1));
}
void solve() {
  for (int i = 0; i < 250; ++i) {
    cin >> a[i];
  }
  sort(a, a + 250);
  reverse(a, a + 250);
  int ans = -1;
  long double best = -1e9;
  for (int i = 1; i <= 1000; ++i) {
    long double p = poisson(i);
    if (p > best) {
      best = p;
      ans = 1;
    }
    long double u = uniform(i);
    if (u > best) {
      best = u;
      ans = 0;
    }
  }
  if (ans)
    cout << "poisson\n";
  else
    cout << "uniform\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  srand(time(NULL));
  hfahuwef[0] = log(1);
  for (int i = 1; i <= 3000; ++i) {
    hfahuwef[i] = hfahuwef[i - 1] + log(i);
  }
  cin >> t;
  while (t--) solve();
}