#include <bits/stdc++.h> using namespace std; int a[1100]; int main() { int t; cin >> t;
while( t -- )
{
int n;
cin >> n;
for( int i = 1 ; i <= 2 * n ; i ++ ) cin >> a[i];
sort(a + 1 , a + 1 + 2 * n);
int s = a[n] - a[1] + a[2 * n] - a[n + 1];
cout << s << endl;
for( int i = 1 ; i <= n ; i ++ )
{
cout << a[i] << ' ' << a[i + n] << endl;
}
}
return 0;
}