// Arup Guha
// 6/5/2026
// Solution to Kattis Problem: Chanukah Challenge
// https://open.kattis.com/problems/chanukah

using namespace std;
#include <bits/stdc++.h>

int main() {

    // Get number of cases.
    int nC;
    cin >> nC;

    // Process cases.
    for (int loop=1; loop<=nC; loop++) {

        // Get input.
        int dummy, n;
        cin >> dummy >> n;

        // Just do the nth Triangle number plus n.
        cout << loop << " " << n*(n+1)/2 + n << endl;
    }

    return 0;
}
