# ICPC Team Management.

#codeifyoucansolve
Little Chandan is an exceptional manager – apart from his role in HackerEarth – as the person who has to bug everyone, in general… and if possible, try to get some work done.

He’s also offered a job as the coach of the best Russian teams participating for ACM-ICPC World Finals. Now, Chandan is an extremely good coach, too. But he’s a weird person who thrives on patterns in life, in general. So, he has decided that if there are n number of students in total, and he is supposed to divide them in camps of k students – he want them to be arranged in such a way that the length of names of all the students in a camp is equal.

I know, totally weird, right?

Input:
The first line will contain the number of test cases. Which will be followed by two integers, n, k – denoting the number of total students, and the number of total students which will be allowed in one camp. After which, n lines will follow denoting the names of all the students who’re willing to learn by the great coach.

Output:
If it is possible for all the students be arranged in a camp of k students, print “Possible”, else print “Not possible”.

Constraints:
1 <= Test Cases <= 50
1 <= N <= 1000
1 <= K <= 1000
1 <= LengthOfAString <= 100
The name of a programmer will always be in lower case.

PS: n%k will ALWAYS be equal to zero – that is, it will possible to divide the n students in equal sized camps of k.

2
6 3
arjit
tijra
genius
chanda
ashish
arjit
4 2
bond
coder
bond
lol

Possible
Not possible

Explanation
In the first case, we can divide the six members into two teams of three with people having equal number of characters in their names. In the second case, we cannot do the same.

```<?php
error_reporting(E_ERROR);
fscanf(STDIN,"%d\n",\$T);
while(\$T--)
{
\$str = trim(fgets(STDIN));
\$str = explode(" ",\$str);
\$N = intval(\$str);
\$K = intval(\$str);
\$rem = \$N%\$K;
if(\$rem !== 0)
{
print("Not possible\n");
continue;
}
\$strarr = array();
\$div = \$N/\$K;
while(\$N--)
{
\$strarr[] = trim(fgets(STDIN));
}
\$team = 0;
\$flag = 0;
for(\$i=0;\$i<count(\$strarr);)
{
\$count = 1;
\$index = \$i+1;
\$team +=1;
for(\$j=\$i+1;\$j<count(\$strarr);\$j++)
{
if(\$count===\$K)
break;
if(strlen(\$strarr[\$i]) === strlen(\$strarr[\$j]))
{
\$temp = \$strarr[\$j];
\$strarr[\$j] = \$strarr[\$index];
\$strarr[\$index] = \$temp;
\$index +=1;
\$count++;

}
}
\$i = \$index;
}
if(\$div === \$team && \$flag !== 1)
print("Possible\n");
else
print("Not possible\n");

}
?>```