Company: Algo university_2june
Difficulty: medium
Frog Freddy Problem Description Apaar is relaxing beside a large pond, while his pet frog Freddy is enjoying in the pond. The pond has N floating leaves, each defined by a x-coordinate and a y-coordinate as viewed from the sky. From leaf located at (a, b) frog Freddy can jump:- to (a + Z, b + Z) where Z is natural number. Call this direction A. to (a + Z, b - Z) where Z is natural number. Call this direction B. to (a - Z, b + Z) where Z is natural number. Call this direction C. to (a - Z, b - Z) where Z is natural number. Call this direction D. Apaar shouts one of the direction and Freddy jumps to the first leaf in chosen direction. If there is no leaf in that direction then Freddy doesn't moves. After Freddy jumps, the leaf Freddy jumps from collapses and sinks forever. Freddy starts from first leaf and we also know all the M commands that Apaar shouted in. Print final x-coordinate and y-coordinate of Freddy the Frog. Examples Example 1: Input: 7 5 ACDBB 5 6 8 9 4 13 1 10 7 4 10 9 3 7