EVENODD - Even and Odd

no tags 

Given undirected graph, we are interested to state 2 points

  1. Is the count of nodes with odd degree, even or odd?
  2. Is the count of nodes with even degree, even or odd?

Use following pseudocode to construct the graph:

    FOR i = 1 to N
        FOR J = 1 to min(N-i, K)
            add_graph_edge(i, i+j);

where node degree is defined as: the number of edges incident to the vertex. This graph will be generated through following pseudocode, for a given N (number of nodes) and K (connectivity factor).

For example, given N = 5, K = 3 we have a graph consisting of 2 nodes with odd degree and 3 nodes with even degree.

Input

The first line of input contains an integer T that represents the number of test cases, then follow T lines each contains only two integer numbers N, K where 1 ≤ N ≤ 100,000 and 0 ≤ K ≤ N.

Output

For each test case, output on a single line “Case #K:” where K is the number of the test case, followed by either "even" or "odd" for the count of nodes with odd degree, then single space, then either "even" or "odd" for the count of nodes with even degree. Check Sample below to see the format.

Example

Input:
1
5 3

Output:
Case #1:
even odd

hide comments
:D: 2012-11-09 21:29:12

Sorry, but that problem is very basic. Although test cases aren't so weak to allow O(N), O(1) is still very easy and requires hardly any coding. Moved to tutorial.


Added by:Mostafa Saad Ibrahim
Date:2012-11-05
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:11th Egyptian Collegiate Programming Contest