Maximum Value

Interview

Time limit1sMemory limit128 MB

Summary
Given a 9x9 grid of numbers, find the maximum value and print its row and column position.
Level

Easy2 of 10

Topics
Array, Implementation
Solved
No attempts yet

Problem

You are given 81 numbers written in a 9 by 9 grid. Each number is either a natural number or 0. Find the largest number, then determine the row and column where that number is located. Row and column numbers start from 1.

Input

Nine lines are given. Each line contains nine integers separated by spaces. Every number is at least 0 and less than 100.

Output

Print the largest number on the first line. On the second line, print the row number and column number of that value, separated by a space. If the largest number appears in more than one cell, you may print any one of its positions.

Examples1

  1. Example 1

    Input
    3 23 85 34 17 74 25 52 65
    10 7 39 42 88 52 14 72 63
    87 42 18 78 53 45 18 84 53
    34 28 64 85 12 16 75 36 55
    21 77 45 35 28 75 90 76 1
    25 87 65 15 28 11 37 28 74
    65 27 75 41 7 89 78 64 39
    47 47 70 45 23 65 3 41 44
    87 13 82 38 31 12 29 29 80
    
    Expected output
    90
    5 7