#include <stdio.h>
int main() {
    char s[105], stack[105];
    int top = -1;
    fgets(s, sizeof(s), stdin);
    
    scanf("%s", s);
    
    for (int i = 0; s[i] != '\0'; i++) {
        char c = s[i];
        
        if (c == '(' || c == '{' || c == '[') {
            stack[++top] = c;
        }
        if (c == ')' || c == '}' || c == ']') {
            if (top == -1) {
                printf("Not Balanced");
                return 0;
            }
            
            char t = stack[top--];
            
            if
    }
}