Back
Close
  • 233

Statement

 Goal

FizzBuzz is a problem that can be described with following rules:
For given f b n integers, in range from 1 to n inclusive, output:
* for multiples of f print Fizz
* for multiples of b print Buzz
* for multiples of f and b print FizzBuzz
* for other cases print the number

Given integer n and n lines of FizzBuzz output, find original f and b values.
Input
Line 1: An integer n for the FizzBuzz lines number.
Next n lines: String containing FizzBuzz output line.
Note that this line won't necessary start from 1.
Output
Two space-separated Fizz and Buzz multiplier integers f and b.
Constraints
1 ≤ n ≤ 30
1 ≤ f, b < 60
Example
Input
15
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Output
3 5

A higher resolution is required to access the IDE