public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder out = new StringBuilder();
		int nCases = Integer.parseInt(in.readLine().trim());
		for (int nCase = 0; nCase < nCases; nCase++) {
			char[] word = in.readLine().toCharArray();
			char[] p = new char[word.length];
			char[] t = new char[word.length * 2];
			for (int i = 0; i < word.length; i++)
				t[i] = t[i + word.length] = p[word.length - i - 1] = word[i];
			preprocess(p);
			int res = KMP(p, t);
			if (res == 0)
				out.append("alindrome\n");
			else if (res == 1)
				out.append("palindrome\n");
			else
				out.append("simple\n");
		}
		System.out.print(out);
	}