UNABLE TO GET THE DESIRED FLOW OF INPUT

After declaring the number of test cases, my code takes an element as an input and displays the lower and upper bound and so on. But as per the question, it should first take all inputs from the user and then display the bound for the entered element.