## DMOPC '19 Contest 3 P0 - What is it?

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

Veshy needs help in math class. He has sequences of 10 spaced terms in order of . For each sequence he wants to know if it is arithmetic, geometric, or neither. Output the answer to the sequence on the line. Terms are guaranteed to be integers.

Note:
A arithmetic sequence is a sequence such that it can be written in the form: where and are constants.
A geometric sequence is a sequence such that it can be written in the form: where and are constants.

It may be helpful to know that in an arithmetic sequence, and in a geometric sequence,

In all tests,

#### Input Specification

The first line of input is .
Each the following lines contains 10 integers, , a sequence of numbers.

#### Output Specification

Your output must have lines such that the answer to the sequence is on the line.
If the sequence is arithmetic, output arithmetic.
If the sequence is geometric, output geometric.
If the sequence is neither arithmetic nor geometric, output neither.
If the sequence is both arithmetic and geometric, output both.

#### Sample Input

4
1 2 3 4 5 6 7 8 9 10
2 4 8 16 32 64 128 256 512 1024
1 1 0 0 1 1 0 0 1 1
1 1 1 1 1 1 1 1 1 1

#### Sample Output

arithmetic
geometric
neither
both