// Arup Guha
// 8/3/2026
// Solution to 1990 UCF HS Programming Contest Problem: Legal Words

import java.util.*;

public class words {
	
	// So we can call contains...
	final public static String[] VOWELS = {"a","e","i","o","u","y"};
	
	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);	
		while (stdin.hasNext()) {
		
			// Get input turn into lower case.
			String orig = stdin.next();
			String lower = orig.toLowerCase();
				
			// Mark a word as okay if we find any vowel in it.
			boolean ok = false;
			for (int i=0; i<VOWELS.length; i++)
				if (lower.contains(VOWELS[i]))
					ok = true;
					
			// Ta da!
			if (ok)
				System.out.println(orig+" is legal");
			else
				System.out.println(orig+" is not legal");
		}
	}
}