Theofanis has a riddle for you and if you manage to solve it, he will give you a Cypriot snack halloumi for free (Cypriot cheese).

You are given an integer nn. You need to find two integers ll and rr such that -10^{18} \le l < r \le 10^{18}1018l<r1018 and l + (l + 1) + \ldots + (r - 1) + r = nl+(l+1)++(r1)+r=n.

Input

The first line contains a single integer tt (1 \le t \le 10^41t104) — the number of test cases.

The first and only line of each test case contains a single integer nn (1 \le n \le 10^{18}1n1018).

Output

For each test case, print the two integers ll and rr such that -10^{18} \le l < r \le 10^{18}1018l<r1018 and l + (l + 1) + \ldots + (r - 1) + r = nl+(l+1)++(r1)+r=n.

It can be proven that an answer always exists. If there are multiple answers, print any.

 

title write neagtive numbers,and they say that you only need to print one of the answers,so you only need to print the simplest solution.

this is the simplest.

#include<iostream>
using namespace std;
int main() {
    long long  l[10000] = { 0 }, r[10000] = { 0 };//n为给定的数,l,r为机找的数,且l<r
    unsigned long long n;
    int t = 0;
    cin >> t;
    for (int i = 0;i < t;i++) {
        cin >> n;
        l[i] = 0 - n + 1;
        r[i] = n;
    }
    for (int i = 0;i < t;i++) {
        cout << l[i] << " " << r[i]<<endl;
    }
    return 0;
}
next one is alternative scheme.
#include<iostream>
using namespace std;
int main() {
    long long n = 0, times, p[10000] = { 0 }, q[10000] = { 0 };
    cin >> times;
    for (int i = 0;i < times;i++) {
        cin >> n;
        if (n % 2 == 1) {
            /*cout << (n / 2) << " " << (n / 2 + 1);*/
            p[i] = n / 2;
            q[i] = n / 2 + 1;
        }
        if (n % 2 == 0) {
            int k = n;
            while (k != 1) {
                k /= 2;
                if (k % 2 == 1 && k != 1) {
                    /*cout << n / k - (k / 2) << " " << n / k + (k / 2);*/
                    p[i] = n / k - (k / 2);
                    q[i] = n / k + (k / 2);

                    break;
                }
                else if (k == 1) {
                    /*cout << (0 - n + 1) << " " << n;*/
                    p[i] = 0 - n + 1;
                    q[i] = n;
                }
            }
        }
    }
    for (int i = 0;i < times;i++) {
        cout << p[i] << " " << q[i]<<endl;

    }
    return 0;
}