Heidi is a statistician to the core, and she likes to study the evolution of marmot populations in each of V (1 ≤ V ≤ 100) villages! So it comes that every spring, when Heidi sees the first snowdrops sprout in the meadows around her barn, she impatiently dons her snowshoes and sets out to the Alps, to welcome her friends the marmots to a new season of thrilling adventures.

Arriving in a village, Heidi asks each and every marmot she comes across for the number of inhabitants of that village. This year, the marmots decide to play an April Fools' joke on Heidi. Instead of consistently providing the exact number of inhabitants P (10 ≤ P ≤ 1000) of the village, they respond with a random non-negative integer k, drawn from one of two types of probability distributions:

  Poisson (d'avril) distribution: the probability of getting an answer k is $\frac{p^{k} e^{-P}}{k !}$ for k = 0, 1, 2, 3, ...,  Uniform distribution: the probability of getting an answer k is $\frac{1}{2 P + 1}$ for k = 0, 1, 2, ..., 2P. 

Heidi collects exactly 250 answers per village. Every village follows either the Poisson or the uniform distribution. Heidi cannot tell marmots apart, so she may query some marmots several times, and each time the marmot will answer with a new number drawn from the village's distribution.

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


-----Input-----

The first line of input will contain the number of villages V (1 ≤ V ≤ 100). The following V lines each describe one village. The description of each village consists of 250 space-separated integers k, drawn from one of the above distributions.


-----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 answer came from a uniform distribution.


-----Example-----
Input
2
92 100 99 109 93 105 103 106 101 99 ... (input is truncated)
28 180 147 53 84 80 180 85 8 16 ... (input is truncated)
Output
poisson
uniform



-----Note-----

The full example input is visually represented below, along with the probability distribution function it was drawn from (the y-axis is labeled by its values multiplied by 250).

[Image]

Difficulty: HARD
Tags: Mathematics

Starter code:

Solutions:
def sampleVariance(V):
	X = sum(V) / len(V)
	S = 0.0
	for x in V:
		S += (X - x) ** 2
	S /= len(V) - 1
	return (X, S)
for i in range(int(input())):
	V = list(map(int, input().split()))
	(X, S) = sampleVariance(V)
	v1 = X
	v2 = (2 * X) ** 2 / 12
	print('{}'.format('poisson' if abs(v1 - S) < abs(v2 - S) else 'uniform'))


for i in range(int(input())):
	t = list(map(int, input().split()))
	d = 212 * sum((q ** 2 for q in t)) > sum(t) ** 2
	print(['poisson', 'uniform'][d])


v = int(input())
eps = 130

def ans(a):
	a.sort()
	if len(a) % 2 == 0:
		med = a[len(a) // 2]
	else:
		med = (a[len(a) // 2] + a[len(a) // 2 - 1]) // 2
	l = med - med // 2
	r = med + med // 2
	c1 = c2 = 0
	for i in a:
		if i >= l and i <= r:
			c1 += 1
		else:
			c2 += 1
	if abs(c1 - c2) <= eps:
		return 'uniform'
	else:
		return 'poisson'
for i in range(v):
	cur = [int(i) for i in input().split()]
	print(ans(cur))


import sys
import math
count = int(sys.stdin.readline())
for i in range(count):
	numbers = list(map(int, sys.stdin.readline().split(' ')))
	n = len(numbers)
	total = sum(numbers)
	mean = total * 1.0 / n
	inside = 0
	for number in numbers:
		position = number / mean
		if position >= 0.5 and position <= 1.5:
			inside += 1
	if inside > 0.7 * n:
		print('poisson')
	else:
		print('uniform')


from math import *
n = int(input())
for _ in range(n):
	a = [int(i) for i in input().split()]
	c = len(a)
	avg = sum(a) / c
	ulik = log(2 * avg + 1) * -c
	plik = 0
	for k in a:
		plik += log(avg) * k
		plik += -avg
		for i in range(1, k + 1):
			plik -= log(i)
	isu = ulik > plik
	ans = ['poisson', 'uniform'][isu]
	print(ans)


import math

def poisson_p(k, P):
	result = 1
	for i in range(1, k + 1):
		result *= P / i
	return result * math.exp(-P)
V = int(input())
for _ in range(V):
	ks = list(map(int, input().split()))
	N = len(ks)
	P = sum(ks) / N
	var = sum(((k - P) ** 2 for k in ks)) / N
	poisson_var = P
	uniform_var = 2 / (2 * P + 1) * sum((a ** 2 for a in range(round(P) + 1)))
	print('poisson' if abs(var - poisson_var) < abs(var - uniform_var) else 'uniform')


import sys

def uniform_variance(mean):
	return (2 * mean) ** 2 / 12

def poisson_variance(mean):
	mean = sum(a) / len(a)
	return mean

def dist(a):
	mean = sum(a) / len(a)
	var = 0
	for k in a:
		var += (mean - k) ** 2
	var /= len(a)
	uniform = abs(uniform_variance(mean) - var)
	poisson = abs(poisson_variance(mean) - var)
	if uniform > poisson:
		return 'poisson'
	else:
		return 'uniform'
n = int(sys.stdin.readline())
for i in range(n):
	a = [int(x) for x in sys.stdin.readline().split()]
	print(dist(a))


from statistics import mean
from math import factorial, log
_lf = []

def logfact(n):
	nonlocal _lf
	CALCLEN = 2200
	if not _lf:
		_lf = [0] * CALCLEN
		for i in range(2, CALCLEN):
			_lf[i] = _lf[i - 1] + log(i)
	return _lf[n]

def unif_ml(xs):
	p1 = mean(xs)
	p2 = max(xs) / 2
	pmle = max(p1, p2)
	loglh = len(xs) * log(2 * pmle + 1)
	return loglh

def poiss_ml(xs):
	pml = mean(xs)
	loglh = len(xs) * pml + sum([-x * log(pml) + logfact(x) for x in xs])
	return loglh

def solve(xs):
	ul = unif_ml(xs)
	pl = poiss_ml(xs)
	if ul < pl:
		print('uniform')
	else:
		print('poisson')

def __starting_point():
	v = int(input())
	for i in range(v):
		xs = [int(x) for x in input().split()]
		solve(xs)
__starting_point()


for i in range(int(input())):
	t = list(map(int, input().split()))
	p = sum(t) / 250
	d = sum(((q - p) ** 2 for q in t)) / 250
	print(['poisson', 'uniform'][6 * d > p * p])