public class Parentheses {
	public static void main(String[] args) {
		String e = "(()(()))";
		
		char[] eChars = e.toCharArray();
		
		int depth = 0;
		for (int i = 0; i < eChars.length; i++) {
			if (eChars[i] == '(') ; // BLANK_0
			if (eChars[i] == ')') ; // BLANK_1
			if (depth < 0) break;
		}
		if (depth != 0) {
			System.out.println("syntax error");
		}
		else {
			System.out.println("OK");
		}
	}
}
