Problem: There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (for some reason they prefer name "snookah")! When a competition takes place somewhere far from their hometown, Ivan, Artsem and Konstantin take a flight to the contest and back.

Jinotega's best friends, team Base have found a list of their itinerary receipts with information about departure and arrival airports. Now they wonder, where is Jinotega now: at home or at some competition far away? They know that: 

  * this list contains all Jinotega's flights in this year (in arbitrary order), 
  * Jinotega has only flown from his hometown to a snooker contest and back, 
  * after each competition Jinotega flies back home (though they may attend a competition in one place several times), 
  * and finally, at the beginning of the year Jinotega was at home. 



Please help them to determine Jinotega's location!

Input

In the first line of input there is a single integer n: the number of Jinotega's flights (1 ≤ n ≤ 100). In the second line there is a string of 3 capital Latin letters: the name of Jinotega's home airport. In the next n lines there is flight information, one flight per line, in form "XXX->YYY", where "XXX" is the name of departure airport "YYY" is the name of arrival airport. Exactly one of these airports is Jinotega's home airport.

It is guaranteed that flights information is consistent with the knowledge of Jinotega's friends, which is described in the main part of the statement.

Output

If Jinotega is now at home, print "home" (without quotes), otherwise print "contest".

Examples

Input

4
SVO
SVO-&gt;CDG
LHR-&gt;SVO
SVO-&gt;LHR
CDG-&gt;SVO


Output

home


Input

3
SVO
SVO-&gt;HKT
HKT-&gt;SVO
SVO-&gt;RAP


Output

contest

Note

In the first sample Jinotega might first fly from SVO to CDG and back, and then from SVO to LHR and back, so now they should be at home. In the second sample Jinotega must now be at RAP because a flight from RAP back to SVO is not on the list.

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
/**
 * Author:-Milap Shah
 * College:-DA-IICT
 */
public class Main {

    public static void main(String[] args) {
        InputReader s = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        /*My code starts here.*/
                
        int test = s.nextInt();
        String sb = s.readString();
        int count = 0;
        int x = test;
        while(test -- != 0)
        {
        	StringBuilder sr = new StringBuilder(s.readString());
        	if((sr.substring(0,3).toString()).equals(sb))
        		count++;
        }
        if(x%2 == 0 && count == x/2)
        	out.println("home");
        else
        	out.println("contest");
        /*My code ends here.*/
        out.close();
    }
    
    

    static class Node {
		ArrayList <Long>arr;

		public Node(){
			this.arr = new ArrayList<Long>();
		}

	}
    
    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}
class Node implements Comparable <Node>{
    long val;
    String str;
    public Node(String str,long val) {
        this.str = str;
        this.val = val;
    }
    public int compareTo(Node that) {
       // String str1 = this.str + that.str,
       //        str2 = that.str + this.str;
        if((that.val - this.val)<0)
        	return -1;
        else if(((that.val - this.val)>0))
        	return 1;
        else
        {
        	return (this.str).compareTo(that.str);
        }
    }
}   


class MyMergeSort {
    
    private int[] array;
    private int[] tempMergArr;
    private int length;
 
//    public static void main(String a[]){
//         
//        int[] inputArr = {45,23,11,89,77,98,4,28,65,43};
//        MyMergeSort mms = new MyMergeSort();
//        mms.sort(inputArr);
//        for(int i:inputArr){
//            System.out.print(i);
//            System.out.print(" ");
//        }
//    }
    
//    public MyMergeSort(int arr[])
//    {
//    	this.array = arr;
//    }
    
    public void sort(int inputArr[]) {
        this.array = inputArr;
        this.length = inputArr.length;
        this.tempMergArr = new int[length];
        doMergeSort(0, length - 1);
    }
 
    private void doMergeSort(int lowerIndex, int higherIndex) {
         
        if (lowerIndex < higherIndex) {
            int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
            // Below step sorts the left side of the array
            doMergeSort(lowerIndex, middle);
            // Below step sorts the right side of the array
            doMergeSort(middle + 1, higherIndex);
            // Now merge both sides
            mergeParts(lowerIndex, middle, higherIndex);
        }
    }
 
    private void mergeParts(int lowerIndex, int middle, int higherIndex) {
 
        for (int i = lowerIndex; i <= higherIndex; i++) {
            tempMergArr[i] = array[i];
        }
        int i = lowerIndex;
        int j = middle + 1;
        int k = lowerIndex;
        while (i <= middle && j <= higherIndex) {
            if (tempMergArr[i] <= tempMergArr[j]) {
                array[k] = tempMergArr[i];
                i++;
            } else {
                array[k] = tempMergArr[j];
                j++;
            }
            k++;
        }
        while (i <= middle) {
            array[k] = tempMergArr[i];
            k++;
            i++;
        }
 
    }
}