unittest
{
	assert( [ "5", "6 7 9 10 31" ].parse.expand.solve == "APPROVED" );
	assert( [ "3", "28 27 24" ].parse.expand.solve == "DENIED" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	foreach( a; as )
	{
		if( a % 2 == 0 && a % 3 != 0 && a % 5 != 0 ) return "DENIED";
	}
	return "APPROVED";
}
