// Arup Guha
// 3/5/2016
// Solution to 2015 MCPC Problem D: Hidden Password

import java.util.*;

public class hidden {

	public static void main(String[] args) {
		Scanner stdin = new Scanner(System.in);
		String password = stdin.next();
		String encoding = stdin.next();
		System.out.println(pass(password, encoding));
	}

	public static String pass(String password, String encoding) {

		int n = password.length();

		// Look for each password letter.
		for (int i=0; i<n; i++) {

			// Find the letter that comes first of the rest left in the password.
			int bestIndex = -1;
			int best = encoding.length();
			for (int j=i; j<n; j++) {
				int tmp = encoding.indexOf(password.charAt(j));
				if (tmp != -1 && tmp < best) {
					bestIndex = j;
					best = tmp;
				}
			}

			// This is what the requirement is.
			if (bestIndex != i) return "FAIL";

			// Just chop this off for the next iteration.
			encoding = encoding.substring(best+1);
		}

		// If we get here, we're good.
		return "PASS";
	}
}