Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Niko Plays PUBG

By DiscoFighter47 · Limits 2s, 1.0 GB

Gone are those days when Niko used to be a noob PUBG player. Now he gets “Chicken Dinner” every now and then. But Barney Stinson said, “Whatever you do in this life, it is not legendary unless your friends are there to see it”. So, Niko wants to play PUBG with his school friends online.

To play PUBG together, players connect their PC’s via LAN cable. Two players can play together if their PC’s are connected by a serial of LAN cable(s). Now, given which PC’s are connected via LAN cable, help Niko and friends to find whether they can play PUBG together.


Input starts with an integer T (≤ 100), denoting the number of test cases. Each case starts with a line containing three integers n (2 ≤ n ≤ 1000), m (0 ≤ m ≤ 10000) and q (1 ≤ q ≤ 10000) where n denotes the number of players, m denotes the number of PC pairs connected directly via a LAN cable and q denotes the number of time(s) Niko and his friends want to play. Each of the next m lines contains two integers u, v (1 ≤ u, v ≤ n, u ≠ v) meaning that player u and v connected their PCs via a LAN cable. Next q lines denote two integers a and b (1 ≤ a, b ≤ n, a≠b ) meaning player a and b want to play a match.


For each case, print the case number in a line first. Then for each match print “Chicken dinner coming soon!” if player a and b can play together, else print “Eat vegetables!”. See sample input/output for more info.


5 3 2
1 2
1 3
4 5
2 3
1 4
Case 1:
Chicken dinner coming soon!
Eat vegetables!



    75% Solution Ratio

    fsshakkhorEarliest, Dec '18

    PureProteaFastest, 0.1s

    yasir.nabilLightest, 26 MB

    foyaz05Shortest, 697B


    Login to submit

    Related Contests

    Intra NSU Programming Contest Fall 2018 Ended at 2018-11-23 07:20:00 +0000 UTC
    Replay of Intra NSU Programming Contest Fall 2018 Ended at 2018-12-07 17:00:00 +0000 UTC
    Inter University Girls' Programming Contest Season 2 Mock Ended at 2019-07-18 16:00:00 +0000 UTC