Hide

Problem E
Equal Shots

/problems/wcfd21.equalshots/file/statement/en/img-0001.jpg
Assorted shots. Photo by the Culinary Geek.

Your bartending skills have much improved since you joined ScrollBar. In particular, you have learned a wide variety of recipes for small drinks called shots. Shots are typically mixed from different liquids containing varying levels of alcohol. For reasons of fairness towards your customers, you want to compare the alcohol contents of your recipies.

Given two shot recipes, determine if they have the same alcohol content or not.

Input

The first line of input contains two integers $a$ and $b$: the number of ingredients in the first shot and the second shot, respectively. Both $a$ and $b$ are at least $1$ and at most $10$. The next $a$ lines describes the ingredients in the first shot, followed by $b$ lines with the ingredients in the second shot.

An ingredient is described by two integers: the amount $v$ that was used (in centilitres), and its alcohol content $c$ (by volume) in precent. We have $1\leq v\leq 100$ and $0\leq c\leq 100$.

There are at most $100$ centilitres in each shot.

Output

Output different if the shots differ in alcohol content, and same otherwise.

Sample Input 1 Sample Output 1
2 1
2 40
2 20
4 30
same
Sample Input 2 Sample Output 2
2 2
2 40
2 20
2 30
2 30
same
Sample Input 3 Sample Output 3
1 1
2 40
2 18
different

Please log in to submit a solution to this problem

Log in