#include <bits/stdc++.h>
using namespace std;
#define s(a) scanf("%d", &a)
#define ss(s) scanf("%s", s)
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)

int color[100] ;
//same is used to store all the element which belong to same set 
vector<int> same[105] ;
//diff is used to store all element which must belong different set
vector<pair<int,int>> diff;

//normal dfs
void dfs( int v , int col , int par )
{
	color[v] = col;
	for( auto u : same[v] )
	{ 
		if( u != par )
		    dfs( u , col , v);
	}
}


int main() {
	
   int n , a;
   s(n);
   while( n!= 0 )
   {
   	int j = 0;
   	//clearing data
   	for( int i = 1 ; i <= n ; i++ )
   	{
   		same[i].clear();
   		color[i] = -1;
   	}
   	diff.clear();
   	
   	char s[10];
   	int flag = 0;
   	for( int i = 1 ; i <= n ; i++ )
   	{
   		s(a);
   		ss(s);
   	
   		
   		if( s[0] == 'f' )
   		{
   			//if string is false then statements belong to different set i.e, one can
   		   //be true and other can be false or vice-versa
   			diff.push_back(mk(i,a));
   			j++;
   		}
   		else
   		{
   			//if string is true then either both are true or false i.e, they belong
   			//to same set 
   			same[i].pb(a);
   			same[a].pb(i);
   		}
   	}
   	
      //flag is 1 if there is paradox and 0 if there is no paradox
      // a paradox is encountered if two elements of same sets are said to be false
   	for( int i = 0 ; i < j ; i++ )
   	{
   		int a = diff[i].first , b = diff[i].second;
   	
   		
   		if( color[a] == -1 && color[b] == -1 )
   		{
   			// if both are uncolored then color one and if other one is colored 
   			// then we know a and b belonged to same set , so it is a paradox
   			
   			dfs(a,0,0);
   			if( color[a] == color[b] )
   			{ 
   				flag = 1;
   				break;
   			}
   			dfs(b,1,0);
   		}
   		else if( color[a] != -1 && color[b] == -1 )
   		{
   			//one colored and other uncolored
   			dfs(b,1-color[a],0);
   			if( color[a] == color[b] )
   			{
   			    	flag = 1;
   			   	break;
   			}
   			
   		}
   		else if( color[a] == -1 && color[b] != -1 )
   		{
   			dfs(a , 1-color[b],0);
   			if( color[a] == color[b] )
   			{
   				
   					flag = 1;
   					break;
   				
   			}
   		}
   		else if( color[a] == color[b] )
   		{
   			// if both are colored by the same color 
   			dfs( a ,1-color[a] ,0);
   			if( color[a] == color[b] )
   			{
   				flag = 1;
   				break;
   			}
   		}
   			
   	}
   	
   	if( flag )
   	{
   		cout << "PARADOX\n";
   	}
   	else
   	{
   		cout << "NOT PARADOX\n";
   	}
   	s(n);
   }
   
   
   
	return 0;
}