149. Balls

Problem Statement:
Do you know 'Sokolombo'?

Sokolombo is a clever child that loves balls. He has an infinite number of balls of all colors. One day Sokolombo's mother gave him money to buy more balls. Sokolombo went to the store and took a look on the available balls.

There are many balls in different RGB colors (Red-Green-Blue). Each ball has a price. Sokolombo needs to know how many balls he can buy from each color. In other way; how many red balls he can buy if he spent all his money on red balls, and how many green balls he can buy if he spent all his money on green balls... And so on.

Input Format:
The first line of input is the number of test cases; it is approximately equal to 100. Each test case consists of many lines. The first line contains two integers p and n : p is the amount of money that Sokolombo has , n is the number of balls available in the store (n <= 100). Followed by n lines, each describes a ball. A ball is described by a character ('R' or 'G' or 'B') indicates its color and a positive integer indicates its price.

Output Format:
For each test case output three lines specifying how many balls Sokolombo can buy from each color in the following format:
Red balls = ?
Green balls = ?
Blue balls = ?

The '?' is replaced with the real number of balls that Sokolombo can buy from that color.

Print a blank line after each test case.

Sample Input:
2 555 6 G 19 B 73 R 10 R 54 R 93 G 41 939 9 B 96 B 54 R 46 R 89 R 10 R 49 G 68 B 92 B 11

Sample Output:
Red balls = 3 Green balls = 2 Blue balls = 1 Red balls = 4 Green balls = 1 Blue balls = 4

 Added by: feras_kassar Added at: 2014-03-14 19:00:00 UTC Time Limit: 3 seconds Partial score: No Source: Damascus University Second Training Contest 2014