Given a positive integer n. The task is to find the nth telephone number.
The telephone numbers or the involution numbers are a sequence of integers that count the ways n telephone lines can be connected to each other, where each line can be connected to at most one other line
Telephone numbers also used to derive the number of ways to place n rooks on an n x n chessboard in such a way that no two rooks attack each other, and in such a way that the configuration of the rooks is symmetric under a diagonal reflection of the board.
The first line of the input contains an integer T denoting the number of test cases. The description of each test case is as follows. Each test case contains a single line with one integer ' N ' for which you have to find the Nth telephone number.
For each N, output the Nth telephone number. Print under modulo 109 + 7.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.