#include <bits/stdc++.h>
using namespace std;
stack<char> c;
int main(){
string l;
cin>>l;
int n=l.size();
c.push('!');
for(int i=0;i<n;i++){
if(l[i]==')'){if( c.top()=='(')c.pop();else {cout<<"Wrong";return 0;}}
else if(l[i]==']'){if( c.top()=='[')c.pop();else {cout<<"Wrong";return 0;}}
else c.push(l[i]);
}
if(c.size()==1)cout<<"OK"<<endl;
else cout<<"Wrong"<<endl;
return 0;
}