Giter Club home page Giter Club logo

isenbaev's Introduction

Problem. Vladislav Isenbaev is a two-time programming champion of the Urals, vice-champion of TopCoder Open 2009, absolute champion of ACM ICPC 2009. In the time you spend reading this condition, Vladislav would have already solved one problem. Or maybe two... Since Vladislav Isenbaev is a graduate of the USU SUNC, it is not surprising that many of the former and current USU Olympiads have known him for many years. Some of them proudly declare that they played with Vladislav in the same team. Or played in a team with Vladislav's former teammates ... We define the Isenbaev number as follows. Vladislav himself has this number equal to zero. For those who played with him on the same team, it is equal to one. For those who played together with Vladislav's teammates, but did not play with him himself, this number is two, and so on. Help automate the process of calculating Isenbaev's numbers so that every olympiad at USU can know how close he is to the ACM ICPC champion.

Initial data The first line contains an integer n — the number of commands (1 ≤ n ≤ 100). Each of the next n lines contains the compositions of these teams in the form of the names of three participants. The last name of each participant is a non-empty string consisting of English letters, no more than 20 characters long. The first letter of the surname is capital, all the rest are lowercase. Vladislav's surname is "Isenbaev".

Result For each participant presented in the input, print on a separate line his last name and Isenbaev's number separated by a space. If this number is not defined, print "undefined" instead. Participants must be ordered by last name in lexicographic order.

Sample Input 7 Isenbaev Oparin Toropov Ayzenshteyn Oparin Samsonov Ayzenshteyn Chevdar Samsonov Fominykh Isenbaev Oparin Dublennykh Fominykh Ivankov Burmistrov Dublennykh Kurpilyanskiy Cormen Leiserson Rivest

Sample Output Ayzenshteyn 2 Burmistrov 3 Chevdar 3 Cormen undefined Dublennykh 2 Fominykh 1 Isenbaev 0 Ivankov 2 Kurpilyanskiy 3 Leiserson undefined Oparin 1 Rivest undefined Samsonov 2 Toropov 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.