#include <iostream>
using namespace std;
#include <bits/stdc++.h>
#include<utility>
#include <algorithm>
#include<iterator>
#define go return 0
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i,n) for(int i=0;i<n;++i)
#define rep(j,n) for(int j=0;j<n;++j)
#define REP(i,n) for(int i=1;i<=n;++i)
#define all(v) ((v).begin()), ((v).end())
#define len(s) ((int)s.size())
#define F first
#define S second
#define pb push_back
#define pf push_front
#define m_p make_pair
typedef long long ll;
typedef double db;
typedef vector<ll> ve;
typedef vector<pair<string, ll> > vepa;
typedef set<ll>se;
typedef map<ll,ll> mpp;
const ll N=1e6+5,OO=1e14,MOD=1e9+7;
const int di[]={1,-1,0,0,-1,1};
const int dj[]={0,0,1,-1,-1,1};
ll TC,n,m,k,a,b,c,d,x,y,l,r,cnt,ans,mx,mn,arr[N];
char grid[600][600];
bool vis[1005],mark[1005],f,ff;
ve adj[N],v;
void dfs1(int node=0){
vis[node]=1;
for(auto it:adj[node])if(!vis[it])dfs1(it);
}
void dfs2(int node){
mark[node]=1;
for(auto it:adj[node])if(!mark[it])dfs2(it);
}
int main(){
IOS;
//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
cin>>n;
ve v;
rep(i,n){
cin>>a>>c;
v.pb(a);
rep(j,c){
cin>>b;
adj[a].pb(b);
}
}
dfs1();
for(auto it:v){
if(it==0)continue;
if(!vis[it]){f=1;cout<<"UNREACHABLE "<<it<<"\n"; }
dfs2(it);
if(!mark[0]){f=1; cout<<"TRAPPED "<<it<<"\n"; }
rep(j,1005)mark[j]=0;
}
if(!f)cout<<"NO PROBLEMS";
go;
}
CiNpbmNsdWRlIDxpb3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlPHV0aWxpdHk+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlPGl0ZXJhdG9yPgojZGVmaW5lICBnbyByZXR1cm4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