This page is still under construction.

Parts of this page are still being built. What you see may change.

Robot Race

Time limit2sMemory limit256 MB

Summary
For each polygonal path, decide whether the straight-line distance to any later point never increases along the walk.
Level

Medium7 of 10

Topics
Geometry, Brute force
Solved
No attempts yet

Problem

Robots race along a path that the organizing committee fixes in advance. Every robot starts at the first point of the path, follows the path without leaving it, and stops at the last point.

One point of the path holds a charging station. Every robot carries a device that reports the straight-line distance from the robot to the station. The device does not report the distance that is left along the path.

Some robots run buggy control software. A buggy robot reads the number on its device as the distance left along the path, so it expects that number to keep getting smaller until it reaches the station. The moment the number gets larger, the robot decides that it has already passed the station without charging, and it crashes.

Let p(t)p(t) be the position of a robot at time tt, and let ∣ab∣|ab| be the straight-line distance between two points aa and bb. A path is unfair if the station can be placed at some point of the path so that a buggy robot crashes on the way, that is, if there are three times t1<t2<t3t_1 < t_2 < t_3 such that the robot is at the station at time t3t_3 and

∣p(t1) p(t3)∣<∣p(t2) p(t3)∣.|p(t_1)\,p(t_3)| < |p(t_2)\,p(t_3)|.

A path that is not unfair is fair. The committee has a list of candidate paths and wants to know which of them are fair. Decide for each given path whether it is fair.

Input

The input holds several test cases. The first line of each test case holds an integer nn (1≤n≤10 0001 \le n \le 10\,000), the number of points of the path. Each of the next nn lines holds two integers xx and yy (−106≤x≤106-10^6 \le x \le 10^6, −106≤y≤106-10^6 \le y \le 10^6), the coordinates of one point. The ii-th of those lines gives the ii-th point of the path. A robot starts at the first point, walks the segments joining consecutive points one after another, and stops at the last point. The path does not intersect itself. The input ends with a line that holds a single 0, and that line is not a test case.

Output

For each test case, print one line. Print Fair if the path is fair, and Unfair if it is not.

Examples3

  1. Example 1

    Input
    5
    5 5
    15 5
    25 15
    15 25
    5 25
    4
    0 0
    1 0
    2 1
    3 0
    0
    
    Expected output
    Unfair
    Fair
    
  2. Example 2

    Input
    3
    0 0
    10 0
    10 10
    3
    0 0
    10 0
    9 10
    0
    
    Expected output
    Fair
    Unfair
    
  3. Example 3

    Input
    1
    7 -3
    2
    -1000000 -1000000
    1000000 1000000
    0
    
    Expected output
    Fair
    Fair