Submit | All submissions | Best solutions | Back to list |

## ARIORGEO - Arithmetic or Geometric ? |

Given a sequence of three real numbers, write a program that determine whether the sequence is part of an arithmetic progression or a geometric progression or neither of them.

Recall that an arithmetic progression of n terms with common difference “d” can be written in the form: a, a+d, a+2d, a+3d, ..., a+(n-1)d

and that a geometric progression of n terms with common ratio “r” can be written in the form: a, ar, ar^{2}, ar^{3}, ..., ar^{n-1}

### Input

The first line of the input contains an integer **T **denoting the number of test cases. The description of **T **test cases follows. Each test case is described in a single line containing three space-separated **double precision real numbers**.

### Output

For each test case, output a single line containing either:

- “Arithmetic”: if the numbers form an arithmetic progression.
- “Geometric”: if the numbers form a geometric progression.
- “None”: if the numbers do not form any of them.
- “Both”: if the numbers form both of them.

### Example

Input:6

4 10 16

-4 2 -1

1 4 10

0.5 -0.25 0.125

-1.5 -0.5 0.5

2.18 2.18 2.18Output:Arithmetic

Geometric

None

Geometric

Arithmetic

Both

Added by: | mbk_live |

Date: | 2019-01-09 |

Time limit: | 1s |

Source limit: | 50000B |

Memory limit: | 1536MB |

Cluster: | Cube (Intel G860) |

Languages: | C-CLANG C C++ 4.3.2 CPP CPP14 CPP14-CLANG C99 JAVA PYTHON PYTHON3 SWIFT |