#include
<
iostream
>
#include
<
cstdio
>
#include
<
cstdlib
>
#include
<
cstring
>
using
namespace
std;
#define
maxn 1005
#define
maxm 100005
#define
inf 0x3f3f3f3f
struct
Edge
{
int
v, w, next;
} edge[maxm
*
3
];
int
n, m;
int
head[maxn];
int
vis[maxn], cost[maxn];
bool
inq[maxn];
int
q[maxn];
bool
ok;
int
ecount;
void
addedge(
int
a,
int
b,
int
w)
{
edge[ecount].next
=
head[a];
head[a]
=
ecount;
edge[ecount].v
=
b;
edge[ecount].w
=
w;
ecount
++
;
}
void
input()
{
getchar();
for
(
int
i
=
0
; i
<
m; i
++
)
{
char
ch;
int
a, b, c;
scanf(
"
%c
"
,
&
ch);
if
(ch
==
'
V
'
)
{
scanf(
"
%d%d
"
,
&
a,
&
b);
if
(a
==
b)
ok
=
false
;
addedge(b, a,
1
);
}
else
{
scanf(
"
%d%d%d
"
,
&
a,
&
b,
&
c);
if
(a
==
b
&&
c
!=
0
)
ok
=
false
;
addedge(b, a, c);
addedge(a, b,
-
c);
}
getchar();
}
for
(
int
i
=
1
; i
<=
n; i
++
)
addedge(
0
, i,
0
);
}
bool
relax(
int
a,
int
b,
int
w)
{
if
(cost[b]
<
cost[a]
+
w)
{
cost[b]
=
cost[a]
+
w;
return
true
;
}
return
false
;
}
bool
spfa()
{
memset(vis,
0
,
sizeof
(vis));
memset(inq,
0
,
sizeof
(inq));
for
(
int
i
=
0
; i
<=
n; i
++
)
cost[i]
=
-
inf;
int
front
=
0
, rear
=
1
;
cost[
0
]
=
0
;
q[
0
]
=
0
;
inq[
0
]
=
true
;
while
(front
!=
rear)
{
int
u
=
q[front
++
];
if
(front
==
maxn)
front
=
0
;
inq[u]
=
false
;
for
(
int
i
=
head[u]; i
!=
-
1
; i
=
edge[i].next)
{
int
v
=
edge[i].v;
if
(relax(u, v, edge[i].w)
&&
!
inq[v])
{
q[rear
++
]
=
v;
inq[v]
=
true
;
vis[v]
++
;
if
(vis[v]
>
n)
return
false
;
if
(rear
==
maxn)
rear
=
0
;
}
}
}
return
true
;
}
int
main()
{
//
freopen("t.txt", "r", stdin);
while
(scanf(
"
%d%d
"
,
&
n,
&
m)
!=
EOF)
{
memset(head,
-
1
,
sizeof
(head));
ecount
=
0
;
ok
=
true
;
input();
if
(spfa()
&&
ok)
printf(
"
Reliable\n
"
);
else
printf(
"
Unreliable\n
"
);
}
return
0
;
}