Code for the Gangster

All submissions for this problem are available.
Gray Khan has been given a task by his father Spray Khan. As badass as he is, Gray Khan is a total newbie at programming (he won’t admit it though) and he has ordered you to help him complete the task.
Now, the task is as follows. You are given an integer N and you have to choose a subset from numbers ranging from 1 to N and suppose we call it S. All the entries in S are distinct.
The chosen subset S should be such that you can form all numbers from 1 to N using sum of the numbers of any subset of S.
The main task is to minimise the number of the elements of the subset S and if there are several possible subsets with the same minimum size you have tell the subset S with minimum possible sum of all elements.
Since Gray Khan has to complete the task by today help him as soon as possible.
Input
There are several test cases. The first line of the input will be the number of test cases T and in the next T lines there will be an integer N.
Output
Output T lines each containing minimum number of elements of subset S and their sum for that particular test case separated by spaces.
Constraints
 1 ≤ T ≤ 10^5
 1 ≤ N ≤ 10^9
Example
Input: 2 1 8
Output: 1 1 4 10
Explanation
Example case 1: The set {1} is optimal.
Example case 2: The set {1,2,3,4} is optimal.
Author:  sandeep_2795 
Tags  sandeep_2795 
Date Added:  12022016 
Time Limit:  2 sec 
Source Limit:  50000 Bytes 
Languages:  ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.3.2, CPP 6.3, CPP14, CS2, D, ERL, FORT, FS, GO, HASK, ICK, ICON, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, NODEJS, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYPY, PYTH, PYTH 3.5, RUBY, SCALA, SCM chicken, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 