- All Contests
- ProjectEuler+
- Project Euler #100: Arranged probability

# Project Euler #100: Arranged probability

# Project Euler #100: Arranged probability

_{This problem is a programming version of Problem 100 from projecteuler.net}

If a box contains twenty-one coloured discs, composed of fifteen blue discs and six red discs, and two discs were taken at random, it can be seen that the probability of taking two blue discs is as follows:

The next such arrangement, for which there is exactly 50% chance of taking two blue discs at random, is a box containing eighty-five blue discs and thirty-five red discs.

Find the first arrangement to contain discs in total where the probability of taking two blue discs is exactly .

**Input Format**

The first line containts an integer , the number of test cases. The next lines each contain three space-separated integers .

**Constraints**

**Output Format**

For each test case, print the number of blue discs and the number of total discs separated by a space. If there is no solution, print "No solution" instead.

Every number in the output will be less than , but it may be easier to approach this problem using bignums, depending on implementation.

**Sample Input**

```
5
1 2 2
1 2 5
1 2 100
1 4 100
3 8 1000
```

**Sample Output**

```
3 4
15 21
85 120
No solution
931 1520
```