#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout;
ll a,b,c,A,B,C;
cin>>a>>b>>c>>A>>B>>C;
if(a>60||b>60||c>60) cout<<"PASS"<<endl;
else cout<<"FAIL"<<endl;
if((a*A+b*B+c*C)/(A+B+C)>=60) cout<<"PASS";
else cout<<"FAIL";
return 0;
}