/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming
Final Contest

Solution to Hidden Password: https://open.kattis.com/problems/hidden
*/

#include <bits/stdc++.h>
using namespace std;

int main() {
    string p, s;
    cin >> p >> s;

    //Store a pointer to which password character is next
    int ptr = 0;
    //Loop through each character in the test word
    for(char c : s) {
        //Find the earliest match in the password
        int match = -1;
        for(int i = p.size()-1; i >= ptr; i--) {
            if(c == p[i]) match = i;
        }

        //If we matched the target character, go to the next one
        if(match == ptr) ptr++;
        //Otherwise, if we matched a later character, this word fails
        else if(match > ptr) {
            cout << "FAIL\n";
            return 0;
        }
    }

    //If we reach the end of the string, all password characters must have been found
    //Otherwise, the word fails since it does not include the entire password
    if(ptr == p.size()) cout << "PASS\n";
    else cout << "FAIL\n";
}