import std.stdio, std.conv, std.string, std.array;

bool[] makeRange( int from, int to ) {
  bool[] ans = new bool[]( 256 );
  ans[] = false;
  foreach ( i; from .. to + 1 ) {
	ans[ i ] = true;
  }
  return ans;
}

bool[] makeNumber( int i ) {
  bool[] ans = new bool[]( 256 );
  // bool ans[] = new bool[ 256 ];
  ans[] = false;
  ans[ i ] = true;
  return ans;
}

bool[] makeAdd( bool[] a, bool[] b ) {
  bool[] ans = new bool[]( 256 );
  foreach ( i; 0 .. 256 ) {
	foreach ( j; 0 .. 256 ) {
	  if ( a[ i ] && b[ j ] ) {
		ans[ ( i + j ) % 256 ] = true;
	  }
	}
  }
  return ans;
}

bool[] makeSub( bool[] a, bool[] b ) {
  bool[] ans = new bool[]( 256 );
  foreach ( i; 0 .. 256 ) {
	foreach ( j; 0 .. 256 ) {
	  if ( a[ i ] && b[ j ] ) {
		ans[ ( i - j + 256 ) % 256 ] = true;
	  }
	}
  }
  return ans;
}

bool[] makeMult( bool[] a, bool[] b ) {
  bool[] ans = new bool[]( 256 );
  foreach ( i; 0 .. 256 ) {
	foreach ( j; 0 .. 256 ) {
	  if ( a[ i ] && b[ j ] ) {
		ans[ ( i * j ) % 256 ] = true;
	  }
	}
  }
  return ans;
}

bool[] makeDiv( bool[] a, bool[] b ) {
  bool[] ans = new bool[]( 256 );
  foreach ( i; 0 .. 256 ) {
	foreach ( j; 1 .. 256 ) {
	  if ( a[ i ] && b[ j ] ) {
		ans[ ( i / j ) % 256 ] = true;
	  }
	}
  }
  return ans;
}

void main()
{
  int m = to!int( strip( readln ) );
  bool[][ string ] table;
  foreach ( i; 0 .. m ) {
	auto token = split( strip( readln ) );
	table[ token[ 0 ] ] = makeRange( to!int( token[ 1 ] ), to!int( token[ 2 ] ) );
  }
  int n = to!int( strip( readln ) );
  auto tokenArray = split( strip( readln ) );
  if ( solve( table, tokenArray ) ) {
	writeln( "correct" );
  } else {
	writeln( "error" );
  }
}

bool solve ( bool[][ string ] table, string[] tokenArray ) {
  auto ary = new bool[][]( 256, 256 );
  int index = 0;
  foreach ( t; tokenArray ) {
	if ( isNumeric( t ) ) {
	  ary[ index++ ][] = makeNumber( to!int( t ) );
	} else if ( t in table ) {
	  ary[ index++ ][] = table[ t ];
	} else {
	  auto b = ary[ --index ];
	  auto a = ary[ --index ];
	  if ( t == "+" ) {
		ary[ index++ ][] = makeAdd( a, b );
	  } else if ( t == "-" ) {
		ary[ index++ ][] = makeSub( a, b );
	  } else if ( t == "*" ) {
		ary[ index++ ][] = makeMult( a, b );
	  } else if ( t == "/" ) {
		if ( b[ 0 ] ) {
		  return false;
		} else {
		  ary[ index++ ][] = makeDiv( a, b );
		}
	  } else {
		return false;
	  }
	}
  }
  return true;
}