Under construction

Still being built. Things may change

Cooking Water

Interview

Time limit1sMemory limit512 MB

Summary
Given N intervals of time Edward did not watch a pot, decide whether some single boil time is possible, meaning it lies inside every unwatched interval.
Level

Medium4 of 10

Topics
Intervals, Implementation, Greedy
Solved
No attempts yet

Problem

"A watched pot never boils," as the saying goes. Chef Edward has been cooking for ages, and empirically the saying seems to hold in his kitchen. He has yet to see a pot actually start boiling. His wife Gunilla is a bit suspicious of Edward's claim. She knows how he often loses focus after a little while, and thinks it is very likely that Edward gets tired of watching after about the same period of time starting when he puts the pot on the stove.

Being scientifically minded, Gunilla quickly designed an experiment that could help Edward gain more insight into the boiling of pots. Every time during the last week that Edward boiled a pot of water, he wrote down the intervals of time when he was not watching the pot. Now he has a large log of these intervals, and wonders whether Gunilla is right (that is, it may be the case that Edward just happened to look away every time the pot started boiling), or if his hypothesis is correct.

Given this data, is it possible that the pot actually starts boiling after the same amount of time, every time?

Input

The first line of the input contains an integer 1≤N≤1 0001 \le N \le 1\,000, the number of times Edward boiled water in the last week. Then NN descriptions of a boiling follow. Each description contains two numbers 0≤a≤b≤1 0000 \le a \le b \le 1\,000. This means that Edward looked away during seconds [a,b][a, b] (that is, from the start of second aa to the end of second bb), and that Edward first saw the pot boiling once he looked back.

Output

If it is impossible that all the pots actually started boiling at the same point in time, output edward is right. Otherwise, output gunilla has a point.

Examples2

  1. Example 1

    Input
    2
    1 7
    5 5
    
    Expected output
    gunilla has a point
    
  2. Example 2

    Input
    3
    4 6
    4 8
    7 8
    
    Expected output
    edward is right