PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BF0000028. Thông tin có đáng tin? (Is the Information Reliable?)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Thông tin có đáng tin? (Is the Information Reliable?)

Is the Information Reliable?

Source: POJ

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn stations at integer coordinates. P A B X states that station AA is exactly XX units north of BB; V A B states that AA is at least one unit north of BB. Decide whether every statement can hold simultaneously.

Input

First line: n,mn,m. Then follow mm lines of P A B X or V A B.

Output

Print exactly Reliable if consistent, otherwise Unreliable.

Subtasks

  • Subtask 1 (20 points): $2\le n\le 12; 1\le m\le 30; 1\le A,B\le n; A\ne B; 1\le X\le 10^6 (P statements)$.
  • Subtask 2 (30 points): $2\le n\le 200; 1\le m\le 2000; 1\le A,B\le n; A\ne B; 1\le X\le 10^6 (P statements)$.
  • Subtask 3 (50 points): $2\le n\le 1000; 1\le m\le 100000; 1\le A,B\le n; A\ne B; 1\le X\le 10^6 (P statements)$.

Examples

Input

3 4
P 1 2 1
P 2 3 1
V 1 3
P 1 3 1

Output

Unreliable

Explanation

The first two exact statements imply x1−x3=2x_1-x_3=2. The last exact statement requires x1−x3=1x_1-x_3=1, so the data are inconsistent and the answer is Unreliable.