#include<stdio.h>
int stack[100000]={};
int top=-1;
void push(int x)
{
top++;
stack[top]=x;
}
int pop()
{
if(top==-1) return ;
return stack[top--];
}
int main()
{
int n,i,a,c=0,p=0,j,sum=0;
char str[201]={0};
scanf("%d\n",&n);
for(i=0;i<n;i++)
{
gets(str);
if(str[1]=='u')
{
sum=0;
for(j=6 ; str[j]!=' ' ; j++)
{
sum=sum*10+(str[j]-'0');
}
push(sum);
}
else if(str[0]=='t')
{
if(top!=-1)
{
printf("%d\n",stack[top]);
}
else
{
printf("-1\n");
}
}
else if(str[1]=='o')
{
pop();
}
else if(str[0]=='s')
{
printf("%d\n",top+1);
}
else if(str[0]=='e')
{
if(top!=-1)
{
printf("false\n");
}
else
{
printf("true\n");
}
}
}
return 0;
}
*/
#include<stdio.h>
int stack[100000]={};
int top=-1;
void push(int x)
{
top++;
stack[top]=x;
}
int pop()
{
if(top==-1) return ;
return stack[top--];
}
int main()
{
int i,c=0;
char str[50001]={0};
gets(str);
for(i=0;str[i]!=NULL;i++)
{
push(str[i]);
if(str[i]=='(')
{
c++;
}
else
{
c--;
}
}
if(stack[0]!=')' && stack[top]!='(')
{
if(c==0)
{
printf("good");
}
}
else
{
printf("bad");
}
return 0;
}