Given a binary search tree and a number **N**. Your task is to complete the function **findMaxforKey()**, that find's the greatest number in the binary search tree that is less than or equal to N. Print the value of the element if it exists otherwise print -1.

```
Input : N = 24
Output :result = 21
(searching for 24 will be like-5->12->21)
Input : N = 4
Output : result = 3
(searching for 4 will be like-5->2->3)
```

**Input:**

The function takes two argument as input, the reference pointer to the **root **of the binary search tree and integer value **N**.

There will be **T**, test cases and for each test case the function will be called separately.

**Output:**

For each test case print the greatest number in the binary search tree that is less than or equal to N

**Constraints:**

1<=T<=100

1<=N<=10^{3}

**Example:
Input:**

2

5

5 1 3 7 9

8

9

5 2 1 3 12 9 21 19 25

4

7

3

Author: harshitsidhwa

mvsaichaitanya | 110 |

surya jeet singh | 65 |

Karthik Chowdary | 56 |

gogo_92 | 51 |

NagendraNigade | 50 |

Anurag_Singh | 632 |

satyam singh 9 | 504 |

Aman Patel | 478 |

dev_v2 | 478 |

tipu | 430 |

akhayrutdinov | 4771 |

Quandray | 4039 |

sanjay05 | 3668 |

Ibrahim Nash | 3664 |

surbhi_7 | 2816 |