Time Limit: 8 sec / Memory Limit: 64 MB





Example

Input

eggchickenegg


Output

egg
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

int main(){

  char word[8];
  int pre_word=0;
  int age=-1;
  int max_age=0;
  int ans;
  int i;

  i=0;

  while(scanf("%c",&word[i]) != EOF){
    if(word[i] == '\n'){ break; }
    i++;
    word[i]='\0';

    if(strcmp(word,"chicken")==0){

      strcpy(word,"");

      if(pre_word != 1){
	age++;
	if(age > max_age){
	  max_age = age;
	  ans=1;
	}
      }
      else{
	age = 0;
	//cout << "test chi" << endl;
      }
      pre_word=1;
      i=0;
    }


    else if(strcmp(word,"egg")==0){

      strcpy(word,"");

      if(pre_word != 2){
	age++;
	if(age > max_age){
	  max_age = age;
	  ans = 2;
	}
      }
      else{
	age = 0;
	//cout << "test egg" << endl;
      }
      pre_word=2;
      i=0;
    }

  }


  if(ans == 1)
    cout << "chicken" << endl;
  else
    cout << "egg" << endl;

  return 0;
}