A. Neverending competitions

time limit per test:2 seconds
memory limit per test:512 megabytes
input:standard input
output:standard output

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 3capital 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->CDG
LHR->SVO
SVO->LHR
CDG->SVO

output

home

input

3
SVO
SVO->HKT
HKT->SVO
SVO->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.

 //2017-02-14
#include <iostream>
#include <cstdio>
#include <cstring> using namespace std; int main()
{
int n, cnt1, cnt2;
string src, line;
while(cin>>n)
{
cnt1 = ;
cnt2 = ;
cin >> src;
for(int i = ; i < n; i++)
{
cin>>line;
if(src[]==line[]&&src[]==line[]&&src[]==line[])cnt1++;
if(src[]==line[]&&src[]==line[]&&src[]==line[])cnt2++;
}
if(cnt1==cnt2)cout<<"home"<<endl;
else cout<<"contest"<<endl;
} return ;
}

CodeForces765A的更多相关文章

随机推荐

  1. [Python]Threading.Thread之Daemon线程

    之前对Daemon线程理解有偏差,特记录说明: 一.什么是Daemon A thread can be flagged as a "daemon thread". The sign ...

  2. 题解 P1731 【生日蛋糕】

    题面传送门 如果不懂DFS,请自觉睡觉: 如果不懂剪枝,请自觉睡觉: 啊哈,大家的思路一定和我一样--DFS,找个数组存储半径和高,可是如单单使用DFS不加剪枝的话,10分--20分. 所以,我们来想 ...

  3. 【BZOJ3456】轩辕朗的城市规划 EGF+多项式求ln

    我们构造$f(i)$和$g(i)$. 其中$f(x)$表示由$x$个节点构成的无向简单连通图的个数. $g(x)$表示有$x$个节点构成的无向简单图(不要求连通)的个数. 显然,由$x$个节点构成的无 ...

  4. POJ 1101

    #include <iostream> #include <string> #define MAXN 78 #define min _min #define inf 12345 ...

  5. WebForm——浏览器兼容、旋转、缩放、倾斜、移动

    transform属性 一.旋转-rotate(角度deg)-deg为角度单位 -o-transform:rotate(45deg) Opera -ms-transform:rotate(45deg) ...

  6. shell脚本批量部署ssh

    日常运维工作中,需要给几十上百台服务器批量部署软件或者是重启服务器等操作, 这样大量重复性的工作一定很苦恼,本文给大家提供了最基本的批量操作的方法,虽然效率不高,对于初学者来说还是好理解.由于刚开始学 ...

  7. 使用EntityFrameworkCore 连接 MySql

    上篇文章介绍了如何在dotnetcore下使用Dapper连接MySql,这里再介绍使用使用EntityFrameworkCore 连接 MySql. 新建控制台项目,安装下面两个nuget包: In ...

  8. a标签发送邮件

    <a href="Mailto:292808135@qq.com?CC=292808135@qq.com&Subject=反馈&Body=花式求喷~%0A您的不满就是我 ...

  9. Nodejs学习笔记(十一)—数据采集器示例(request和cheerio)

    写在之前 很多人都有做数据采集的需求,用不同的语言,不同的方式都能实现,我以前也用C#写过,主要还是发送各类请求和正则解析数据比较繁琐些,总体来说没啥不好的,就是效率要差一些, 用nodejs写采集程 ...

  10. Idea 2017.3以后版本的破解(亲测有效)转

    转自:http://www.mamicode.com/info-detail-2147137.html 自从升级到idea2017.3之后,之前的license server破解方法貌似已失效.于是找 ...