DWITE Contest

Test Case for Question #4 in DWITE 2007-2008 High School Round 2

Contest: DWITE 2007-2008 High School Round 2
Question: #4
Input File: DATA4.txt
Output File: OUT4.txt


Input

abc121cba
1)a(bc)d(
a[1]b{2}c
(a[1]{c)d}
[({][})]




Output

balanced
not balanced
balanced
not balanced
not balanced