// ------------------------INCLUDES--------------------------- //

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <string>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

// ----------------- Define-s and Typedef-s ------------------ //

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define sz(x) (int)(x).size()
#define mn(a, n) *min_element(a, a + n)
#define mx(a, n) *max_element(a, a + n)
#define mnv(a) *min_element(all(a))
#define mxv(a) *max_element(all(a))
#define FOR(i, a) for (ull i=0;i<(a);++i)
#define FORD(i, a) for (ull i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (ull i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (ull i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vll vector<long long>
#define vull vector<unsigned long long>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

// ----------------------FUNCTIONS-------------------------- //

template <typename T>
istream& operator >>(istream& input, vector <T>& s) {
	for (T& a : s) {
		input >> a;
	}
	return input;
}

template <typename T>
ostream& operator <<(ostream& output, vector <T>& s) {
	for (T& a : s) {
		output << a << ' ';
	}
	output << endl;
	return output;
}

template <typename T>
T gcd(T a, T b) {
	return !b ? a : gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

template <typename T>
int isPrime(T a) {
	if (a == 1) return 1;
	else if (a == 2) return 0;
	else if (!(a % 2)) return 2;
	else {
		for (ull i = 3; i * i <= a; i += 2) {
			if (!(a % i)) return i;
		}
	}
	return 0;
}

int vsum(vector <int> vec) {
	int sum = 0;
	trav(t, vec)
		sum += t;
	return sum;
}

int sumyd(ll n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

ull fact(ull n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * fact(n - 1);
	}
}

// -----------------------SOLUTION----------------------------- //

void solve() {
	int n, a = 4, b = 1;
	cin >> n;
	FOR(i, n) {
		cout << a << ' ';
		if (i == 0) {
			a += 2;
		}
		else if (i == 1) {
			a += 4;
		}
		else if (i == 2) {
			a += 4;
		}
		else {
			if (b == 1) {
				a += 8;
				b = 0;
			}
			else {
				a += 4;
				b = 1;
			}
		}
	}
	cout << endl;
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


// ------------------------INCLUDES--------------------------- //

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <string>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

// ----------------- Define-s and Typedef-s ------------------ //

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define sz(x) (int)(x).size()
#define mn(a, n) *min_element(a, a + n)
#define mx(a, n) *max_element(a, a + n)
#define mnv(a) *min_element(all(a))
#define mxv(a) *max_element(all(a))
#define FOR(i, a) for (ull i=0;i<(a);++i)
#define FORD(i, a) for (ull i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (ull i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (ull i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vll vector<long long>
#define vull vector<unsigned long long>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

// ----------------------FUNCTIONS-------------------------- //

template <typename T>
istream& operator >>(istream& input, vector <T>& s) {
	for (T& a : s) {
		input >> a;
	}
	return input;
}

template <typename T>
ostream& operator <<(ostream& output, vector <T>& s) {
	for (T& a : s) {
		output << a << ' ';
	}
	output << endl;
	return output;
}

template <typename T>
T gcd(T a, T b) {
	return !b ? a : gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

template <typename T>
int isPrime(T a) {
	if (a == 1) return 1;
	else if (a == 2) return 0;
	else if (!(a % 2)) return 2;
	else {
		for (ull i = 3; i * i <= a; i += 2) {
			if (!(a % i)) return i;
		}
	}
	return 0;
}

int vsum(vector <int> vec) {
	int sum = 0;
	trav(t, vec)
		sum += t;
	return sum;
}

int sumyd(ll n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

ull fact(ull n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * fact(n - 1);
	}
}

// -----------------------SOLUTION----------------------------- //

void solve() {
	ull n, a = 2;
	int k = 0;
	cin >> n;
	FOR(i, n) {
		if (!isPrime(a)) {
			cout << a * 2 << ' ';
		}
		else {
			i--;
		}
		if (a == 2)
			a++;
		else
			a += 2;
	}
	cout << endl;
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


// ------------------------INCLUDES--------------------------- //

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <string>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

// ----------------- Define-s and Typedef-s ------------------ //

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define sz(x) (int)(x).size()
#define mn(a, n) *min_element(a, a + n)
#define mx(a, n) *max_element(a, a + n)
#define mnv(a) *min_element(all(a))
#define mxv(a) *max_element(all(a))
#define FOR(i, a) for (ull i=0;i<(a);++i)
#define FORD(i, a) for (ull i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (ull i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (ull i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vll vector<long long>
#define vull vector<unsigned long long>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

// ----------------------FUNCTIONS-------------------------- //

template <typename T>
istream& operator >>(istream& input, vector <T>& s) {
	for (T& a : s) {
		input >> a;
	}
	return input;
}

template <typename T>
ostream& operator <<(ostream& output, vector <T>& s) {
	for (T& a : s) {
		output << a << ' ';
	}
	output << endl;
	return output;
}

template <typename T>
T gcd(T a, T b) {
	return !b ? a : gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

template <typename T>
int isPrime(T a) {
	if (a == 1) return 1;
	else if (a == 2) return 0;
	else if (!(a % 2)) return 2;
	else {
		for (ull i = 3; i * i <= a; i += 2) {
			if (!(a % i)) return i;
		}
	}
	return 0;
}

int vsum(vector <int> vec) {
	int sum = 0;
	trav(t, vec)
		sum += t;
	return sum;
}

int sumyd(ll n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

ull fact(ull n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * fact(n - 1);
	}
}

// -----------------------SOLUTION----------------------------- //

void solve() {
	ull n, a = 1, b = 2;
	int k = 0;
	cin >> n;
	FOR(i, n) {
		cout << a * b + 2 << ' ';
		a = a * b + 2;
	}
	cout << endl;
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


// ------------------------INCLUDES--------------------------- //

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <string>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

// ----------------- Define-s and Typedef-s ------------------ //

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define sz(x) (int)(x).size()
#define mn(a, n) *min_element(a, a + n)
#define mx(a, n) *max_element(a, a + n)
#define mnv(a) *min_element(all(a))
#define mxv(a) *max_element(all(a))
#define FOR(i, a) for (ull i=0;i<(a);++i)
#define FORD(i, a) for (ull i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (ull i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (ull i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vll vector<long long>
#define vull vector<unsigned long long>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

// ----------------------FUNCTIONS-------------------------- //

template <typename T>
istream& operator >>(istream& input, vector <T>& s) {
	for (T& a : s) {
		input >> a;
	}
	return input;
}

template <typename T>
ostream& operator <<(ostream& output, vector <T>& s) {
	for (T& a : s) {
		output << a << ' ';
	}
	output << endl;
	return output;
}

template <typename T>
T gcd(T a, T b) {
	return !b ? a : gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

template <typename T>
int isPrime(T a) {
	if (a == 1) return 1;
	else if (a == 2) return 0;
	else if (!(a % 2)) return 2;
	else {
		for (ull i = 3; i * i <= a; i += 2) {
			if (!(a % i)) return i;
		}
	}
	return 0;
}

int vsum(vector <int> vec) {
	int sum = 0;
	trav(t, vec)
		sum += t;
	return sum;
}

int sumyd(ll n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

ull fact(ull n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * fact(n - 1);
	}
}

// -----------------------SOLUTION----------------------------- //

void solve() {
	ull n, a = 4;
	int k = 0;
	cin >> n;
	cout << a << ' ';
	FOR(i, n) {
		cout << a * 2 - 2 << ' ';
		a = a * 2 - 2;
	}
	cout << endl;
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


// ------------------------INCLUDES--------------------------- //

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <string>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

// ----------------- Define-s and Typedef-s ------------------ //

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define sz(x) (int)(x).size()
#define mn(a, n) *min_element(a, a + n)
#define mx(a, n) *max_element(a, a + n)
#define mnv(a) *min_element(all(a))
#define mxv(a) *max_element(all(a))
#define FOR(i, a) for (ull i=0;i<(a);++i)
#define FORD(i, a) for (ull i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (ull i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (ull i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vll vector<long long>
#define vull vector<unsigned long long>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

// ----------------------FUNCTIONS-------------------------- //

template <typename T>
istream& operator >>(istream& input, vector <T>& s) {
	for (T& a : s) {
		input >> a;
	}
	return input;
}

template <typename T>
ostream& operator <<(ostream& output, vector <T>& s) {
	for (T& a : s) {
		output << a << ' ';
	}
	output << endl;
	return output;
}

template <typename T>
T gcd(T a, T b) {
	return !b ? a : gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

template <typename T>
int isPrime(T a) {
	if (a == 1) return 1;
	else if (a == 2) return 0;
	else if (!(a % 2)) return 2;
	else {
		for (ull i = 3; i * i <= a; i += 2) {
			if (!(a % i)) return i;
		}
	}
	return 0;
}

int vsum(vector <int> vec) {
	int sum = 0;
	trav(t, vec)
		sum += t;
	return sum;
}

int sumyd(ll n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

ull fact(ull n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * fact(n - 1);
	}
}

// -----------------------SOLUTION----------------------------- //

void solve() {
	ull n, a = 3;
	int k = 0;
	cin >> n;
	FOR(i, n) {
		if (!isPrime(a)) {
			cout << a * 2 << ' ';
		}
		else {
			i--;
		}
		a += 2;
	}
	cout << endl;
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


// ------------------------INCLUDES--------------------------- //

#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <array>
#include <string>
#include <climits>
#include <ctime>
#include <cstdlib>
#include <queue>
#include <stack>

using namespace std;

// ----------------- Define-s and Typedef-s ------------------ //

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

#define sz(x) (int)(x).size()
#define mn(a, n) *min_element(a, a + n)
#define mx(a, n) *max_element(a, a + n)
#define mnv(a) *min_element(all(a))
#define mxv(a) *max_element(all(a))
#define FOR(i, a) for (ull i=0;i<(a);++i)
#define FORD(i, a) for (ull i=(a)-1;i>=0;i--)
#define FORT(i,a,b) for (ull i=(a);i<=(b);++i)
#define FORTD(i,b,a) for (ull i=(b);i>=(a);--i)
#define trav(i,v) for (auto i : v)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define ad push_back
#define fr first
#define sc second
#define mpr(a,b) make_pair(a,b)
#define pir pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vll vector<long long>
#define vull vector<unsigned long long>
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

// ----------------------FUNCTIONS-------------------------- //

template <typename T>
istream& operator >>(istream& input, vector <T>& s) {
	for (T& a : s) {
		input >> a;
	}
	return input;
}

template <typename T>
ostream& operator <<(ostream& output, vector <T>& s) {
	for (T& a : s) {
		output << a << ' ';
	}
	output << endl;
	return output;
}

template <typename T>
T gcd(T a, T b) {
	return !b ? a : gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
	return a / gcd(a, b) * b;
}

template <typename T>
int isPrime(T a) {
	if (a == 1) return 1;
	else if (a == 2) return 0;
	else if (!(a % 2)) return 2;
	else {
		for (ull i = 3; i * i <= a; i += 2) {
			if (!(a % i)) return i;
		}
	}
	return 0;
}

int vsum(vector <int> vec) {
	int sum = 0;
	trav(t, vec)
		sum += t;
	return sum;
}

int sumyd(ll n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10;
		n /= 10;
	}
	return sum;
}

ull fact(ull n) {
	if (n == 1) {
		return 1;
	}
	else {
		return n * fact(n - 1);
	}
}

// -----------------------SOLUTION----------------------------- //

void solve() {
	int n, k = 10, p = 0;
	cin >> n;
	if (n == 1) {
		cout << 4 << endl;
	}
	else if (n == 2) {
		cout << 4 << ' ' << 6 << endl;
	}
	else if (n == 3) {
		cout << 4 << ' ' << 6 << ' ' << 10 << endl;
	}
	else {
		cout << "4 6 10 ";
		FOR(i, n - 3) {
			if (p == 0) {
				k += 4;
				cout << k << ' ';
				p = 1;
			}
			else {
				k += 8;
				cout << k << ' ';
				p = 0;
			}
		}
	}
	cout << endl;
}

int main() {
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int gcd (int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}
bool check(int x, vector<int> a) {
	int f = 0;
	for (int i = 0; i < a.size(); i++) {
		if (gcd(x, a[i]) == 1 or (x % a[i] == 0 or a[i] % x == 0)) f = 0;
		else {
			return false;
		}
	}
	return true;
}
int main() {
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	long long int t;
	cin >> t;

	while (t--)
	{

		int n;
		cin >> n;

		vector<int> ans;

		ans.push_back(1);
		int cnt = 0;
		for (int i = 3; i <= 4 * n; i++) {
			if (check(i, ans)) {
				ans.push_back(i);
				cnt++;
			}

			if (cnt == n - 1) break;
		}

		for (auto x : ans) cout << x << " ";
		cout << endl;
	}	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int gcd (int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}
bool check(int x, vector<int> a) {
	int f = 0;
	for (int i = 0; i < a.size(); i++) {
		if (gcd(x, a[i]) == 1 or (x % a[i] == 0 or a[i] % x == 0)) f = 0;
		else {
			return false;
		}
	}
	return true;
}
int main() {
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	long long int t;
	cin >> t;

	while (t--)
	{

		int n;
		cin >> n;

		vector<int> ans;

		ans.push_back(4);
		int cnt = 0;
		for (int i = 5; i <= 4 * n; i++) {
			if (check(i, ans)) {
				ans.push_back(i);
				cnt++;
			}

			if (cnt == n - 1) break;
		}

		for (auto x : ans) cout << x << " ";
		cout << endl;
	}	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int gcd (int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}
int main() {
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	long long int t;
	cin >> t;
	while (t--)
	{
		int n;
		cin >> n;
		int f = 0;
		int last = -1;
		int cnt = 0;
		for (int i = 1; i <= 4 * n; i++) {
			if (gcd(i, last) == 1 or (i % last == 0 or last % i == 0))
				if (last == -1) last = 1;
			if (i != last) {
				cout << i << " ";
				last = i;
			}
			cnt++;
			if (cnt == n + 1) break;

		} cout << endl;

	}	return 0;

}


#include<bits/stdc++.h>
using namespace std;
void sieve(int p[], int n) {
	p[1] = 0;
	p[0] = 0;
	p[2] = 1;
	for (int i = 3; i <= n; i += 2) {
		p[i] = 1;
	}
	for (int i = 3; i <= n; i++) {
		if (p[i] == 1) {
			for (int j = i * i; j <= n; j += i) {
				p[j] = 0;
			}
		}
	}

}

int main() {

	long long int t;
	cin >> t;
	int p[10000] = {0};
	sieve(p, 10000);
	while (t--)
	{	int cnt = 0;
		int n;
		cin >> n;
		for (int i = 0; i <= 4 * n; i++) {
			if (p[i] == 1){cout << i << " ";
			cnt++;}
			if (cnt == n) break;
		}cout<<endl;
	}	return 0;

}


#include<bits/stdc++.h>
using namespace std;
void sieve(int p[], int n) {
	p[1] = 0;
	p[0] = 0;
	p[2] = 1;
	for (int i = 3; i <= n; i += 2) {
		p[i] = 1;
	}
	for (int i = 3; i <= n; i++) {
		if (p[i] == 1) {
			for (int j = i * i; j <= n; j += i) {
				p[j] = 0;
			}
		}
	}

}

int main() {

	long long int t;
	cin >> t;
	int p[10000] = {0};
	sieve(p, 10000);
	while (t--)
	{	int cnt = 0;
		int n;
		cin >> n;
		for (int i = 0; i <= 4 * n; i++) {
			if (p[i] == 1){cout << 2*i << " ";
			cnt++;}
			if (cnt == n) break;
		}cout<<endl;
	}	return 0;

}


#include<bits/stdc++.h>
using namespace std;

int main() {

	long long int t;
	cin >> t;
	while (t--)
	{	int cnt = 0;
		int n;
		cin >> n;

		  int c=4*n;
    while(n){
        cout<<c<<" ";
        c-=2;
        n--;
    }
    cout<<endl;

	}	return 0;

}


#include<bits/stdc++.h>
using namespace std;
int gcd (int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}
bool check(int x, vector<int> a) {
	for (int i = 0; i < a.size(); i++) {
		if (gcd(x, a[i]) == 1 or (x % a[i] == 0 or a[i] % x == 0)) return true;
	}
	return false;
}
int main() {
/*#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif*/
	long long int t;
	cin >> t;

	while (t--)
	{

		int n;
		cin >> n;

		vector<int> ans;

		ans.push_back(1);
		int cnt = 0;
		for (int i = 2; i <= 4 * n; i++) {
			if (check(i, ans)) {
				ans.push_back(i);
				cnt++;
			}

			if (cnt == n - 1) break;
		}

		for (auto x : ans) cout << x << " ";
		cout << endl;
	}	return 0;

}


#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        int sum;
        if(num%2==0){
            sum=num;
        }
        else{
            sum=num+1;
        }
        int k=0;
        for(int i=sum;k<num;i+=2){
            cout<<i<<" ";
            k++;
        }
        if(t>0)
            cout<<endl;
    }
}


#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        int sum;
        if(num%2==0){
            sum=num;
        }
        else{
            sum=num+1;
        }
        int k=num+sum;
        for(int i=sum;i<k;i+=2){
            cout<<i<<" ";
        }
        cout<<endl;
    }
}


#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        int sum;
        if(num%2==0){
            sum=num;
        }
        else{
            sum=num+1;
        }
        for(int i=sum;i<=num*2;i+=2){
            cout<<i<<" ";
        }
        cout<<endl;
    }
}


#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        for(int i=2;i<=num*2;i+=2){
            cout<<i<<" ";
        }
        cout<<endl;
    }
}


#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        int sum;

        int k=0;
        for(int i=num*4;k<num;i-=2){
            cout<<i<<" ";
            k++;
        }
        if(t>0)
            cout<<endl;
    }
}


#include<stdio.h>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        for(int i=2;i<=num*2;i+=2){
            cout<<i<<" ";
        }
        cout<<endl;
    }
}


#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        int sum;
        if(num%2==0){
            sum=num;
        }
        else{
            sum=num+1
        }
        for(int i=sum;i<=num*2;i+=2){
            cout<<i<<" ";
        }
        cout<<endl;
    }
}


#include<iostream>
using namespace std;

int main(){
    int t;
    cin>>t;
    while(t--){
        int num;
        cin>>num;
        int sum;
        if(num%2==0){
            sum=num;
        }
        else{
            sum=num+1;
        }
        int k=0;
        for(int i=sum;k<num;i+=2){
            cout<<i<<" ";
            k++;
        }
        cout<<endl;
    }
}


/* HEADERS + NAMESPACES */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

/* MACROS */
#define BOOST() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define FILL(v, x) memset(v, x, sizeof(v))
#define REP(i, a, b) for (__typeof(b)i = a; i < b; ++i)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(), (v).end()
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
#define int long long
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define INF (1LL << 60)
#define N 100005
#define MOD 1000000007
// #define MOD 998244353

/* TEMPLATES */
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v: V) os << v << " ";
    return os << "]\n";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.F << ", " << P.S << ")\n";
}
template<class T> ostream& operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for(auto s: S) os << s << " ";
    return os << "}\n";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for(auto m: M) os << "(" << m.ff << ":" << m.ss << ") ";
    return os << "}\n";
}
// template<class T> using ordered_set =
//     tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/* GLOBAL */
/* FUNCTIONS */
void solve() {
    int n;
    cin >> n;
    vi u, v = {
        2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
        59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
        127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191,
        193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
        269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347,
        349, 353, 359, 367, 373, 379, 383, 389, 397
    };

    u.pb(4);
    REP(i, 0, n) {
        REP(j, i + 1, SZ(v)) {
            if(i != j && v[i] * v[j] <= 4 * n)
                u.pb(v[i] * v[j]);
        }
    }
    REP(i, 0, n) cout << u[i] << " ";
    cout << "\n";
}

int32_t main() {
    BOOST();
    int t = 0;
    if (!t) cin >> t;

    REP(_, 1, t + 1) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
}


/* HEADERS + NAMESPACES */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

/* MACROS */
#define BOOST() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define FILL(v, x) memset(v, x, sizeof(v))
#define REP(i, a, b) for (__typeof(b)i = a; i < b; ++i)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(), (v).end()
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
#define int long long
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define INF (1LL << 60)
#define N 100005
#define MOD 1000000007
// #define MOD 998244353

/* TEMPLATES */
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v: V) os << v << " ";
    return os << "]\n";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.F << ", " << P.S << ")\n";
}
template<class T> ostream& operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for(auto s: S) os << s << " ";
    return os << "}\n";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for(auto m: M) os << "(" << m.ff << ":" << m.ss << ") ";
    return os << "}\n";
}
// template<class T> using ordered_set =
//     tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/* GLOBAL */
/* FUNCTIONS */
void solve() {
    int n;
    cin >> n;
    vi u, v = {
        2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
        59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
        127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191,
        193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
        269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347,
        349, 353, 359, 367, 373, 379, 383, 389, 397
    };

    REP(i, 0, n) {
        REP(j, i + 1, SZ(v)) {
            u.pb(v[i] * v[i + j]);
            if(SZ(u) == n) {
                REP(k, 0, n) cout << u[k] << " ";
                cout << "\n";
                return;
            }
        }
    }
}

int32_t main() {
    BOOST();
    int t = 0;
    if (!t) cin >> t;

    REP(_, 1, t + 1) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
}


/* HEADERS + NAMESPACES */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

/* MACROS */
#define BOOST() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define FILL(v, x) memset(v, x, sizeof(v))
#define REP(i, a, b) for (__typeof(b)i = a; i < b; ++i)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(), (v).end()
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
#define int long long
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define INF (1LL << 60)
#define N 100005
#define MOD 1000000007
// #define MOD 998244353

/* TEMPLATES */
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v: V) os << v << " ";
    return os << "]\n";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.F << ", " << P.S << ")\n";
}
template<class T> ostream& operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for(auto s: S) os << s << " ";
    return os << "}\n";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for(auto m: M) os << "(" << m.ff << ":" << m.ss << ") ";
    return os << "}\n";
}
// template<class T> using ordered_set =
//     tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/* GLOBAL */
/* FUNCTIONS */
void solve() {
    int n;
    cin >> n;
    vi u, v = {
        2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
        59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113,
        127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191,
        193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263,
        269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347,
        349, 353, 359, 367, 373, 379, 383, 389, 397
    };

    REP(i, 0, n) if(2 * v[i] <= 4 * n) u.pb(2 * v[i]);
    if(SZ(u) >= n) {
        REP(i, 0, n) cout << u[i] << " ";
        cout << "\n";
    }

    else {
        u.clear();
        REP(i, 0, n) {
            REP(j, i + 1, SZ(v)) {
                if(v[i] * v[i + j] <= 4 * n)
                    u.pb(v[i] * v[j]);
            }
        }
        REP(i, 0, n) cout << u[i] << " ";
        cout << "\n";
    }
}

int32_t main() {
    BOOST();
    int t = 0;
    if (!t) cin >> t;

    REP(_, 1, t + 1) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
}


/* HEADERS + NAMESPACES */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

/* MACROS */
#define BOOST() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define FILL(v, x) memset(v, x, sizeof(v))
#define REP(i, a, b) for (__typeof(b)i = a; i < b; ++i)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(), (v).end()
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
#define int long long
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define INF (1LL << 60)
#define N 100005
#define MOD 1000000007
// #define MOD 998244353

/* TEMPLATES */
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v: V) os << v << " ";
    return os << "]\n";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.F << ", " << P.S << ")\n";
}
template<class T> ostream& operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for(auto s: S) os << s << " ";
    return os << "}\n";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for(auto m: M) os << "(" << m.ff << ":" << m.ss << ") ";
    return os << "}\n";
}
// template<class T> using ordered_set =
//     tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/* GLOBAL */
/* FUNCTIONS */
void solve() {
    int n;
    cin >> n;

    int m = 4;
    REP(i, 0, n) {
        cout << m << " ";
        if(i == 0) m += 2;
        else m += 4;
    }
    cout << "\n";
}

int32_t main() {
    BOOST();
    int t = 0;
    if (!t) cin >> t;

    REP(_, 1, t + 1) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
}


/* HEADERS + NAMESPACES */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

/* MACROS */
#define BOOST() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define FILL(v, x) memset(v, x, sizeof(v))
#define REP(i, a, b) for (__typeof(b)i = a; i < b; ++i)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(), (v).end()
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
#define int long long
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define INF (1LL << 60)
#define N 100005
#define MOD 1000000007
// #define MOD 998244353

/* TEMPLATES */
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v: V) os << v << " ";
    return os << "]\n";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.F << ", " << P.S << ")\n";
}
template<class T> ostream& operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for(auto s: S) os << s << " ";
    return os << "}\n";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for(auto m: M) os << "(" << m.ff << ":" << m.ss << ") ";
    return os << "}\n";
}
// template<class T> using ordered_set =
//     tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/* GLOBAL */
/* FUNCTIONS */
void solve() {
    int n;
    cin >> n;
    vi u, v = {
        2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59,
        61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131,
        137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199
    };

    u.pb(4);
    REP(i, 0, SZ(v)) {
        REP(j, i + 1, SZ(v)) {
            if (v[i] * v[j] <= 4 * n)
                u.pb(v[i] * v[j]);
        }
        if(SZ(u) >= n) break;
    }

    REP(i, 0, n) cout << u[i] << " ";
    cout << "\n";
}

int32_t main() {
    BOOST();
    int t = 0;
    if (!t) cin >> t;

    REP(_, 1, t + 1) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
}


/* HEADERS + NAMESPACES */
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;

/* MACROS */
#define BOOST() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define FILL(v, x) memset(v, x, sizeof(v))
#define REP(i, a, b) for (__typeof(b)i = a; i < b; ++i)
#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(), (v).end()
#define DB(x) cerr << __LINE__ << ": " << #x << " = " << (x) << "\n"
#define int long long
#define ii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define INF (1LL << 60)
#define N 100005
#define MOD 1000000007
// #define MOD 998244353

/* TEMPLATES */
template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v: V) os << v << " ";
    return os << "]\n";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) {
    return os << "(" << P.ff << ", " << P.ss << ")\n";
}
template<class T> ostream& operator<<(ostream &os, set<T> S) {
    os << "{ ";
    for(auto s: S) os << s << " ";
    return os << "}\n";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> M) {
    os << "{ ";
    for(auto m: M) os << "(" << m.ff << ":" << m.ss << ") ";
    return os << "}\n";
}
// template<class T> using ordered_set =
//     tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

/* GLOBAL */
/* FUNCTIONS */
void solve() {
    int n;
    cin >> n;
    REP(i, 0, n) cout << 4 * n - 2 * i << " ";
    cout << "\n";
 }

int32_t main() {
    BOOST();
    int t = 0;
    if (!t) cin >> t;

    REP(_, 1, t + 1) {
        // cout << "Case #" << _ << ": ";
        solve();
    }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    while(n--){
        int a;
        cin>>a;
        int b=a-1;
        int c=a+1;
        for(int i=n+1; i<4*a; i++){
            if(b!=1){
                if(i%a==0|| i%c==0 || i%b==0){
                cout<<i<< " ";
                }
            }

            else if(i%a==0 || i%c==0 ){

                cout<<i<< " ";
            }
        }
        cout<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    while(n--){
        int a;
        cin>>a;
        a--;
        vector<int>v;
        v.push_back(4*a);
        int i=2;
        while(a--){
            int k=(4*a)-i;
            i+=i;
            v.push_back(k);
        }
        for(int &x:v)cout<<x<< " ";
        cout<<endl;
        v.clear();
    }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    while(n--){
        int a;
        cin>>a;
        for(int i=1; i<=4*a; i++){
            if(i%a==0 && i!=a){
                cout<<i<< " ";
            }
        }
        cout<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin>>n;
    while(n--){
        int a;
        cin>>a;
        for(int i=1; i<4*a; i++){
            if(i%a==0){
                cout<<i<< " ";
            }
        }
        cout<<endl;
    }
}


/* spread the truth */
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define ii pair<int , int>
double pi = 2 * acos(0.0);

template < typename T > ostream & operator<<(ostream & os, const vector < T > &v)
{
	os << '{';
  for (const auto & x:v)
		os << " " << x;
	return os << '}';
}

void solve()
{
	int n;
	cin >> n;
	vector < int >vect;
	int input;
	for (int i = 0; i < n; i++)
	{
		cin >> input;
		vect.pb(input);
	}
	sort(vect.begin(), vect.end());
	int sol = vect[n - 1] - vect[0];
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			sol = min(sol, vect[j] - vect[i]);
		}
	}
	cout << sol << endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}

	return 0;
}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{   int t,n,s[100],min;
    cin>>t;
    for(int i=0;i<t;i++)
    {   cin>>n;
        for(int j=0;j<n;j++)
        {   cin>>s[j];

        }
        sort(s,s+n, greater<int>());
        min=s[0]-s[1];
        for(int j=0;j<n-1;j++)
        {   if(min>s[j]-s[j+1])
                min=s[j]-s[j+1];
        }
        cout<<min<<endl;
    }

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{   int t,n,s[100];
    cin>>t;
    for(int i=0;i<t;i++)
    {   cin>>n;
        for(int j=0;j<n;j++)
        {   cin>>s[j];

        }
        sort(s,s+n, greater<int>());

        cout<<s[0]-s[1]<<endl;

    }

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{   int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {   cin>>n;
        for(int j=0;j<n;j++)
        {   cin>>s[j];

        }
        sort(s,s+n, greater<int>());

        cout<<s[0]-s[1]<<endl;

    }

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{   int t,n,s[100];
    cin>>t;
    for(int i=0;i<t;i++)
    {   cin>>n;
        for(int j=0;j<n;j++)
        {   cin>>s[j];

        }
        sort(s,s+n, greater<int>());
        min=s[0]-s[1];
        for(int j=0;j<n-1;j++)
        {   if(min>s[j]-s[j+1])
                min=s[j]-s[j+1];
        }
        cout<<min<<endl;
    }

}


#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main()
{   int t;
    cin>>t;
    for(int i=0;i<t;i++)
    {   cin>>n;
        for(int j=0;j<n;j++)
        {   cin>>s[j];

        }
        sort(s,s+n, greater<int>());

        cout<<a[0]-a[1]<<endl;

    }

}


#include<iostream>
#include<cmath>
#include<string>
#include<algorithm>
#include<iomanip>
#include<vector>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int t, a[100000], l;
    cin >> t;
    for(int i = 0; i < t; i++)
    {
        l = 999;
        int n;
        cin >> n;
        for(int j = 0; j < n; j++) cin >> a[j];
        sort(a, a + n);
        for(int j = 0; j < n - 1; j++)
            if(l > a[j + 1] - a[j]) l = a[j + 1] - a[j];
        cout << l << "\n";
    }
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <utility>
#include <cmath>
#include <string>
#include <bitset>
#include <queue>
#include <cstdio>
#include <cstring>
#include <deque>
#include <unordered_map>
#include <climits>
#include <map>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <ctime>
#include <cstdint>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define fa(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>b;--i)
#define setp pair<pair<int,int>,int>
#define setl pair<int,int>
#define M_PI 3.14159265358979323846

using namespace std;

LL gcd(LL a, LL b) { return a % b ? gcd(b, a % b) : b; }
LL lcm(LL a, LL b) { return (a * b) / gcd(a, b); }
pair <int, int> vu[4] = { {0,1}, {0,-1} , {1,0},{-1,0} }; // EWSN

const int max_v = 1e3 + 7;
const int INF = 1e9 + 7;

bool arr[max_v];
int n;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int cnt; ci(cnt);
	while (cnt--)
	{
		vector <int> vi;
		memset(arr, 0, sizeof(arr));
		ci(n);
		bool tk = 0;
		fa(i, 0, n)
		{
			int x; ci(x);
			if (arr[x])
			{
				tk = 1;
			}
			else
			{
				arr[x] = 1;
				vi.push_back(x);
			}
		}

		if (tk) co(0 << "\n");
		else
		{
			int ans = INF;
			sort(vi.begin(), vi.end());
			int p = vi[0];
			fa(i, 1, vi.size())
			{
				ans = min(vi[i] - p, ans);
			}
			co(ans << "\n");
		}

	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <utility>
#include <cmath>
#include <string>
#include <bitset>
#include <queue>
#include <cstdio>
#include <cstring>
#include <deque>
#include <unordered_map>
#include <climits>
#include <map>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <ctime>
#include <cstdint>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define fa(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>b;--i)
#define setp pair<pair<int,int>,int>
#define setl pair<int,int>
#define M_PI 3.14159265358979323846

using namespace std;

LL gcd(LL a, LL b) { return a % b ? gcd(b, a % b) : b; }
LL lcm(LL a, LL b) { return (a * b) / gcd(a, b); }
pair <int, int> vu[4] = { {0,1}, {0,-1} , {1,0},{-1,0} }; // EWSN

const int max_v = 1e3 + 7;
const int INF = 1e9 + 7;

bool arr[max_v];
int n;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int cnt; ci(cnt);
	while (cnt--)
	{
		vector <int> vi;
		memset(arr,0,sizeof(arr));
		ci(n);
		bool tk = 0;
		fa(i, 0, n)
		{
			int x; ci(x);
			if (arr[x])
			{
				tk = 1;
			}
			else
			{
				arr[x] = 1;
				vi.push_back(x);
			}
		}

		if (tk) co(0 << "\n");
		else
		{
			int ans = INF;
			sort(vi.begin(), vi.end());
			int p = vi[0];
			fa(i, 1, vi.size())
			{
				ans = min(vi[i] - p, ans);
				p = vi[i];
			}
			co(ans << "\n");
		}

	}
	return 0;
}


// https://codeforces.com/problemset/problem/959/A
// SOLUTION BY DN54321

#include <iostream>
#include <string.h>
#include <ctype.h>
#include <vector>
#include <functional>
#include <algorithm>

#define p1 first
#define p2 second
#define pii pair<int,int>
#define MXINT (1<<30)

typedef long long ll;
using namespace std;

int main() {
	int t, n, res;
	scanf("%d", &t);
	for (int tc = 0; tc < t; ++t) {
		scanf("%d", &n);
		vector<int> v(n);
		res = MXINT;
		for (int i = 0; i < n; ++i) {
			scanf("%d", &v[i]);
		}
		sort(v.begin(), v.end());
		for (int i = 1; i < n; ++i) {
			if (v[i] - v[i - 1] < res) res = v[i] - v[i - 1];
		}
		printf("%d\n", res);
	}
	return 0;
}


// https://codeforces.com/problemset/problem/1360/B
// SOLUTION BY DN54321

#include <iostream>
#include <string.h>
#include <ctype.h>
#include <vector>
#include <functional>
#include <algorithm>

#define p1 first
#define p2 second
#define pii pair<int,int>
#define MXINT (1<<30)

typedef long long ll;
using namespace std;

int main() {
	int t, n, res;
	scanf("%d", &t);
	for (int tc = 0; tc < t; ++tc) {
		scanf("%d", &n);
		vector<int> v(n);
		res = MXINT;
		for (int i = 0; i < n; ++i) {
			scanf("%d", &v[i]);
		}
		sort(v.begin(), v.end());
		for (int i = 1; i < n; ++i) {
			if (v[i] - v[i - 1] < res) res = v[i] - v[i - 1];
		}
		printf("%d\n", res);
	}
	return 0;
}


// ConsoleApplication19.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
using namespace std;

void sort(int* arr, int* size) {
	for (int i = 0; i < *size; i++) {
		for (int j = 0; j < *size - 1; j++) {
			if (arr[j] > arr[j + 1]) {
				int* temp = new int;
				*temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = *temp;
				delete temp;
			}
		}
	}
}

int main()
{
	int* n_tests = new int;
	cin >> *n_tests;

	int* leasts = new int[*n_tests];

	for (int i = 0; i < *n_tests; i++) {

		int* n_athletes = new int;
		cin >> *n_athletes;

		int* athletes = new int[*n_athletes];

		for (int j = 0; j < *n_athletes; j++) {
			cin >> athletes[j];
		}
		int* least = new int(9999);
		for (int j = 0; j < *n_athletes - 1; j++) {
			for (int k = j + 1; k < *n_athletes; k++) {
				if (*least > abs(athletes[j] - athletes[k])) {
					*least = abs(athletes[j] - athletes[k]);
				}
			}
		}
		leasts[i] = *least;
		delete least;
		delete n_athletes;
		delete[]athletes;
	}
	for (int i = 0; i < *n_tests; i++) {
		cout << leasts[i] << endl;
	}
	delete n_tests;
	delete[]leasts;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started:
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file


// Example program
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main()
{ int n;
    cin >> n;
    while(n>0){
        int num;
        cin >> num;
        int *arr = new int[num];
        for(int i=0; i<num; i++) cin >> arr[i];
        quickSort(arr, 0, num-1);
        cout << calDif(arr, num) << "\n";
        n--;
    }
}


// Example program
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main()
{
    int n;
    cin>>n;
    int result[52];
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        int arr[10000];
        for(int j=0; j<num; j++){
            cin>>arr[j];

        }
        quickSort(arr,0, num);
        result[i] = minDif(arr, num);
    }

    printArray(result, n);
    return 0;
}


// Example program
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main()
{
    int n;
    cin>>n;
    int result[52];
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        int arr[10000];
        for(int j=0; j<num; j++){
            cin>>arr[j];

        }
        quickSort(arr,0,num-1);
        result[i] = minDif(arr, num);
    }

    printArray(result, n);
    return 0;
}


//
//  main.cpp
//  20200602_CodeForces_1360a
//
//  Created by KuN on 6/2/20.
//  Copyright © 2020 KuN. All rights reserved.
//

#include <iostream>
#include <cstdlib>

using namespace std;

void swap(int &a, int &b)
{
    int t = a;
    a = b;
    b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];    // pivot
    int left = low;
    int right = high - 1;
    while(true){
        while(left <= right && arr[left] < pivot) left++;
        while(right >= left && arr[right] > pivot) right--;
        if (left >= right) break;
        swap(arr[left], arr[right]);
        left++;
        right--;
    }
    swap(arr[left], arr[high]);
    return left;
}

/* Hàm thực hiện giải thuật quick sort */
void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        /* pi là chỉ số nơi phần tử này đã đứng đúng vị trí
         và là phần tử chia mảng làm 2 mảng con trái & phải */
        int pi = partition(arr, low, high);

        // Gọi đệ quy sắp xếp 2 mảng con trái và phải
        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void oput(int a[], int n){
    for(int i=0; i<n; i++){
        cout << a[i] << " ";
    }
}

int calDif(int a[], int n){
    int minDif = abs(a[0] - a[1]);
    for(int i=1; i<n-1;i++){
        if(minDif > abs(a[i] - a[i+1])) minDif = abs(a[i] - a[i+1]);
    }
    return minDif;
}

int main(int argc, const char * argv[]) {
    /*int a[6] = {7,4,6,1,9,3};
    quickSort(a, 0, 5);
    oput(a, 6);*/

    int n;
    cin >> n;
    while(n>0){
        int num;
        cin >> num;
        int *arr = new int[num];
        for(int i=0; i<num; i++) cin >> arr[i];
        quickSort(arr, 0, num-1);
        cout << calDif(arr, num) << "\n";
        n--;
    }

    return 0;
}


// Example program
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main()
{
    int n;
    cin>>n;
    int result[52];
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        int arr[10000];
        for(int j=0; j<num; j++){
            cin>>arr[j];

        }
        quickSort(arr,0, num-1);
        result[i] = minDif(arr, num);
    }

    printArray(result, n);
    return 0;
}


#include <iostream>
#include <cstdlib>

using namespace std;

int minimumArea(int a, int b){
    int t = (a>b)?b:a;
    if(2*t<(a+b-t)) return 2*(a+b-t);
    else return t*t*4;
}

int output(int arr[], int n){
    for(int i=0; i<n; i++){
        cout<<n;
    }
}

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=0; i<n-1; i++){
        min = (min>abs(arr[i]-arr[i+1]))    min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main(){
    int n;
    cin>>n;
    int result[];
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        int arr[];
        for(int j=0; j<num; j++){
            cin>>arr[j];
        }
        quicksort(arr, num);

        result[i] = minDif(arr, num);
    }

    output(result, n);

    return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main(int argc, const char * argv[]) {
    int n;
    cin >> n;
    while(n>0){
        int num;
        cin >> num;
        int *arr = new int[num];
        for(int i=0; i<num; i++) cin >> arr[i];
        quickSort(arr, 0, num-1);
        cout << minDif(arr, num) << "\n";
        n--;
    }

    return 0;
}


// Example program
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=0; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main()
{
    int n;
    cin>>n;
    int result[52];
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        int arr[10000];
        for(int j=0; j<num; j++){
            cin>>arr[j];

        }
        result[i] = minDif(arr, num);
    }

    printArray(result, n);
    return 0;
}


// Example program
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main()
{
    int n;
    cin>>n;
    int result[52];
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        int arr[10000];
        for(int j=0; j<num; j++){
            cin>>arr[j];

        }
        result[i] = minDif(arr, num);
    }

    printArray(result, n);
    return 0;
}


// Example program
#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main()
{
    int n;
    cin>>n;
    int result[52];
    for(int i=0; i<n; i++){
        int num;
        cin>>num;
        int arr[10000];
        for(int j=0; j<num; j++){
            cin>>arr[j];

        }
        quickSort(arr,n);
        result[i] = minDif(arr, num);
    }

    printArray(result, n);
    return 0;
}


#include <iostream>
#include <string>
#include <cstdlib>

using namespace std;

void swap(int* a, int* b)
{
    int t = *a;
    *a = *b;
    *b = t;
}

int partition (int arr[], int low, int high)
{
    int pivot = arr[high];
    int i = (low - 1);

    for (int j = low; j <= high - 1; j++)
    {
        if (arr[j] < pivot)
        {
            i++;
            swap(&arr[i], &arr[j]);
        }
    }
    swap(&arr[i + 1], &arr[high]);
    return (i + 1);
}

void quickSort(int arr[], int low, int high)
{
    if (low < high)
    {
        int pi = partition(arr, low, high);

        quickSort(arr, low, pi - 1);
        quickSort(arr, pi + 1, high);
    }
}

void printArray(int arr[], int size)
{
    int i;
    for (i = 0; i < size; i++)
        cout << arr[i] << " ";
    cout << endl;
}

int minDif(int arr[], int n){
    int min = abs(arr[0]-arr[1]);
    for(int i=1; i<n-1; i++){
        if(min>abs(arr[i]-arr[i+1])) min = abs(arr[i]-arr[i+1]);
    }
    return min;
}

int main(int argc, const char * argv[]) {

    int n;
    cin >> n;
    while(n>0){
        int num;
        cin >> num;
        int *arr = new int[num];
        for(int i=0; i<num; i++) cin >> arr[i];
        quickSort(arr, 0, num-1);
        cout << calDif(arr, num) << "\n";
        n--;
    }

    return 0;
}


#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <functional>
#include <bitset>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

int main(int argc, char** argv) {
	ios::sync_with_stdio(false); cin.tie(0);

	int q; cin >> q;

	while (q--) {

		int n; cin >> n;
		vector<int> a(n);

		for (int& i : a)
			cin >> i;

		sort(a.begin(), a.end());

		int mn = INT_MAX;
		for (int i = 0; i < a.size() - 1; i++) {

			mn = min(mn, a[i + 1] - a[i]);
		}

		cout << mn << endl;
	}
}


#define _USE_MATH_DEFINES
#define ll long long
#define _CRT_SECURE_NO_WARNINGS
#define maxLl 2000000000000000001
#define maxI 1000000001
#include <fstream>
#include <vector>
#include <unordered_map>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <set>
#include <deque>
#include <cctype>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <cassert>
#define module // ����� x // ans % x
#pragma comment(linker, "/STACK:2000000")

using namespace std;

int main() {

	ifstream in("input.txt");
	ofstream out("output.txt");

	int t;
	in >> t;

	for (int w = 0; w < t; w++)
	{
		int n;
		in >> n;
		vector <int> vec;

		for (int i = 0; i < n; i++)
		{
			int m;
			in >> m;
			vec.push_back(m);
		}

		int ans = 100000000;
		for (int i = 0; i < n; i++)
		{
			for (int j = i + 1; j < n; j++)
			{
				ans = min(ans, abs(vec[i] - vec[j]));
			}
		}
		out << ans << endl;
	}

	in.close();
	out.close();
	return 0;
}


#define _USE_MATH_DEFINES
#define ll long long
#define _CRT_SECURE_NO_WARNINGS
#define maxLl 2000000000000000001
#define maxI 1000000001
#include <fstream>
#include <vector>
#include <unordered_map>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <set>
#include <deque>
#include <cctype>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#include <cassert>
#define module // ����� x // ans % x
#pragma comment(linker, "/STACK:2000000")

using namespace std;

int main() {

	ifstream in("input.txt");
	ofstream out("output.txt");

	int t;
	cin >> t;

	for (int w = 0; w < t; w++)
	{
		int n;
		cin >> n;
		vector <ll> vec (n);

		for (int i = 0; i < n; i++)
		{
			cin >> vec[i];
		}

		ll ans = 10000000;
		for (int i = 0; i < n; i++)
		{
			for (int j = i + 1; j < n; j++)
			{
				ans = min(ans, abs(vec[i] - vec[j]));
			}
		}
		cout << ans << endl;
	}

	in.close();
	out.close();
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;

        int main()
        {   int t;
             cin>>t;
            while(t--)
            { int n;
              cin>>n;
              int arr[n];
              for(int i=0;i<n;i++)
              {
                  cin>>arr[i];
              }
              sort(arr,arr+n);
              int mini=1001;
              for (int i=0;i<n-1;i++)
              {
                  int dif=arr[i+1]-arr[i];
                  if(dif<mini)
                    mini=dif;
              }
              cout<<mini<<endl;

            }

           return 0;
        }


#include <bits/stdc++.h>
using namespace std;

        int main()
        {   int t;
             cin>>t;
            while(t--)
            { int n;
              cin>>n;
              int arr[n];
              for(int i=0;i<n;i++)
              {
                  cin>>arr[i];
              }
              sort(arr,arr+n);
              int mini=1001;
              for (int i=0;i<n-1;i++)
              {
                  int dif=arr[i+1]-arr[i];
                  if(dif<mini)
                    mini=dif;
              }
              cout<<mini<<endl;

            }

           return 0;
        }


#include <iostream>
#include<algorithm>
using namespace std;

        int main()
        {   int t;
             cin>>t;
             //int n;
            while(t--)
            {  int n;
              cin>>n;
              int arr[1000];
              for(int i=0;i<n;i++)
              {
                  cin>>arr[i];
              }
              sort(arr,arr+n);
              int mini=1001;
              for (int i=0;i<n-1;i++)
              {
                  int dif=arr[i+1]-arr[i];
                  if(dif<mini)
                    mini=dif;
              }
              cout<<mini<<endl;

            }

           return 0;
        }


#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <sstream>
#include <stack>
#include <time.h>

#ifndef _DEPRECATION_DISABLE   /* One time only */
#define _DEPRECATION_DISABLE   /* Disable deprecation true */
#if (_MSC_VER >= 1400)         /* Check version */
#pragma warning(disable: 4996) /* Disable deprecation */
#endif /* #if defined(NMEA_WIN) && (_MSC_VER >= 1400) */
#endif /* #ifndef _DEPRECATION_DISABLE */

using namespace std;

#ifdef START

int sum(int number) {

	int k = 0;

	while (number) {

		k += number % 10;
		number /= 10;
	}

	return k;
}

vector<int> prefix_function_kmp(string& s) {

	vector<int> pi(s.length(), 0);

	for (int i = 1; i < s.length(); i++)
	{
		int j = pi[i - 1];

		while (j > 0 && s[i] != s[j])
		{
			j = pi[j - 1];
		}

		if (s[i] == s[j])
			++j;

		pi[i] = j;
	}

	return pi;
}

int mx = -1;

int main()
{
	string str,temp,out;

	cin >> str;

	for (int j = 0; j < str.size(); j++) {

		temp = str[j];
		temp += "#";
		temp += str;

		vector<int>vii = prefix_function_kmp(temp);

		int cnt = 0;

		for (int j = 2; j < vii.size(); j++) {

			if (vii[j] == 1)
				cnt++;
		}

		if (cnt > mx) {

			mx = cnt;
			out = str[j];

		}
	}

	cout << out;
	return 0;
}

#else

int main()
{

	int n,t;

	cin >> n;

	int mas[50];

	while (n--) {

		cin >> t;

		memset(mas, 0, 50);

		for (size_t j = 0; j < t; j++) {

			int a;

			cin >> a;

			mas[j] = a;

		}

		sort(mas, mas + t);

		int mn = 10000;

		for (size_t j = 0; j < t - 1; j++) {

			if (mas[j + 1] - mas[j] < mn)
				mn = mas[j + 1] - mas[j];
		}

		cout << mn << endl;
	}

	return 0;
}

#endif


#include <iostream>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <cassert>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <bitset>
#include <sstream>
#include <stack>
#include <time.h>

#ifndef _DEPRECATION_DISABLE   /* One time only */
#define _DEPRECATION_DISABLE   /* Disable deprecation true */
#if (_MSC_VER >= 1400)         /* Check version */
#pragma warning(disable: 4996) /* Disable deprecation */
#endif /* #if defined(NMEA_WIN) && (_MSC_VER >= 1400) */
#endif /* #ifndef _DEPRECATION_DISABLE */

using namespace std;

#ifdef START

int sum(int number) {

	int k = 0;

	while (number) {

		k += number % 10;
		number /= 10;
	}

	return k;
}

vector<int> prefix_function_kmp(string& s) {

	vector<int> pi(s.length(), 0);

	for (int i = 1; i < s.length(); i++)
	{
		int j = pi[i - 1];

		while (j > 0 && s[i] != s[j])
		{
			j = pi[j - 1];
		}

		if (s[i] == s[j])
			++j;

		pi[i] = j;
	}

	return pi;
}

int mx = -1;

int main()
{
	string str,temp,out;

	cin >> str;

	for (int j = 0; j < str.size(); j++) {

		temp = str[j];
		temp += "#";
		temp += str;

		vector<int>vii = prefix_function_kmp(temp);

		int cnt = 0;

		for (int j = 2; j < vii.size(); j++) {

			if (vii[j] == 1)
				cnt++;
		}

		if (cnt > mx) {

			mx = cnt;
			out = str[j];

		}
	}

	cout << out;
	return 0;
}

#else

int main()
{

	int n,t;

	cin >> n;

	set<int>sii;

	while (n--) {

		cin >> t;

		sii.clear();

		for (size_t j = 0; j < t; j++) {

			int a;

			cin >> a;

			sii.insert(a);

		}

		if (sii.size() < t) {

			cout << 0 << endl;
		}
		else
		{
			auto it = sii.begin();

			int cnt = 0;

			int mas[2];

			for (; it != sii.end(); it++) {

				mas[cnt] = *it;

				if (cnt == 1) {

					cout << mas[1] - mas[0] << endl;

					break;
				}

				cnt++;
			}
		}

	}

	return 0;
}

#endif


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int>a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        sort(a.begin(), a.end());
        if (n == 2) {
            cout << a[n - 1] - a[n - 2] << "\n";
        }
        else cout << a[n - 2] - a[n - 3] << "\n";
    }
    return 0;
}


#include <iostream>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    int t;
    cin >> t;
    while (t--) {
        int n, r = 1000;
        cin >> n;
        vector<int>a(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i];
        }
        sort(a.begin(), a.end());
        for (int i = 1; i < n; i++) {
            if (a[i] - a[i - 1] < r)r = a[i] - a[i - 1];
        }
        cout << r << "\n";
    }
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<deque>
#define LL long long int
#define module 1000000007
using namespace std;

int main()
{
    int t; cin >>t;
    while(t--)
    {
       int n; cin >>n;
       vector<int> v;
       for(int i=0;i<n;i++)
       {
           int ti; cin >>ti;
           v.push_back(ti);
       }
       bool ac=true;
       sort(v.begin(),v.end());
       for(int i=0;i<n-1;i++)
       {
           if(v[i]==v[i-1])
           {ac=false; break;}
       }
       if(ac==true)
       {

           cout<<v[1]-v[0]<<endl;
       }
       else
       {
           cout<<"0"<<endl;
       }

    }
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<deque>
#define LL long long int
#define module 1000000007
using namespace std;

int main()
{
    int t; cin >>t;
    while(t--)
    {
       int n; cin >>n;
       vector<int> v;
       for(int i=0;i<n;i++)
       {
           int ti; cin >>ti;
           v.push_back(ti);
       }
       bool ac=true;
       for(int i=0;i<n-1;i++)
       {
           if(v[i]==v[i-1])
           {ac=false; break;}
       }
       if(ac==true)
       {
           sort(v.begin(),v.end());
           cout<<v[1]-v[0]<<endl;
       }
       else
       {
           cout<<"0"<<endl;
       }

    }
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<deque>
#define LL long long int
#define module 1000000007
using namespace std;

int main()
{
    int t; cin >>t;
    while(t--)
    {
       int n; cin >>n;
       vector<int> v;
       for(int i=0;i<n;i++)
       {
           int ti; cin >>ti;
           v.push_back(ti);
       }
       bool ac=true;
       sort(v.begin(),v.end());
       if(n==2) cout<<v[1]-v[0]<<endl;
       else if(n==3) cout<<v[2]-v[1]<<endl;
       else if(n>3)
       {
           for(int i=0;i<n-1;i++)
           {
               if(v[i]==v[i-1])
               {ac=false; break;}
           }
           if(ac==true)
           {

               cout<<v[n-1]-v[n-2]<<endl;
           }
           else
           {
               cout<<"0"<<endl;
           }
        }

    }
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<deque>
#define LL long long int
#define module 1000000007
using namespace std;

int main()
{
    int t; cin >>t;
    while(t--)
    {
       int n; cin >>n;
       vector<int> v;
       for(int i=0;i<n;i++)
       {
           int ti; cin >>ti;
           v.push_back(ti);
       }
       sort(v.begin(),v.end());
       cout<<v[1]-v[0]<<endl;
    }
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<deque>
#define LL long long int
#define module 1000000007
using namespace std;

int main()
{
    int t; cin >>t;
    while(t--)
    {
       int n; cin >>n;
       vector<int> v;
       for(int i=0;i<n;i++)
       {
           int ti; cin >>ti;
           v.push_back(ti);
       }
       int mi=10000;
       sort(v.begin(),v.end());
       for(int i=1;i<n;i++)
       {
           int a=v[i]-v[i-1];
           if(a<mi) mi=a;
       }
       cout<<mi<<endl;
    }
    return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using std::cout;
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	for(int j=0;j<t;j++){
	    int n;
        cin>>n;
        int a;
        vector<int>v;
        for(int i=0;i<n;i++){
            cin>>a;
            v.push_back(a);
        }
        sort(v.begin(),v.end());
        int b=v[1]-v[0];
        for(int i=0;i<n-1;i++){
            b=min(b,v[i+1]-v[i]);
        }
        cout<<b<<endl;
	}
	return 0;
}


#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using std::cout;
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	for(int j=0;j<t;j++){
	    int n;
        cin>>n;
        int a;
        vector<int>v;
        for(int i=0;i<n;i++){
            cin>>a;
            v.push_back(a);
        }
        sort(v.begin(),v.end());
        int b=v[1]-v[0];
        for(int i=0;i<n-2;i++){
            b=min(b,v[i+1]-v[i]);
        }
        cout<<b<<endl;
	}
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main() {
	int t;
	cin >> t;
	int a[1000];

	for (int k = 1; k <= t; k++) {
		int n;
		cin >> n;

		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		sort(a, a + n);

		int diff = 1000;

		for (int i = 0; i < n - 1; i++){
			if (diff > a[i + 1] - a[i]) {
				diff = a[i + 1] - a[i];
			}
		}
		cout << diff << endl;
	}
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <deque>
#include <algorithm>
#include <ctype.h>
#include <string>
#include <map>
#include <numeric>
#include <set>
#include <array>
#include <functional>
#include <cmath>
#include <cstring>
#include <locale>

using namespace std;

int main(){
    int t;
    cin >>t;
    while(t--){
        int n;
        cin >>n;
        int arr[50], temp=1000;
        for(int i=0; i<n; i++){
            cin >>arr[i];
        }
        sort(arr, arr+n);
        for(int j=1; j<n; j++){
            if(temp>arr[j]-arr[j-1])
                temp = arr[j]-arr[j-1];
            if(temp==0)
                break;
        }
        cout << temp <<"\n";
    }
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <deque>
#include <algorithm>
#include <ctype.h>
#include <string>
#include <map>
#include <numeric>
#include <set>
#include <array>
#include <functional>
#include <cmath>
#include <cstring>
#include <locale>

using namespace std;

int main(){
    int t;
    cin >>t;
    while(t--){
        int n,a,b,temp=1000;
        cin >>n >>a;
        while(n>1){
            cin>>b;
            if(temp>abs(a-b))
                temp=abs(a-b);
            n--;
        }
        cout <<temp <<"\n";
    }
}


#include <iostream>
#include <iomanip>
#include <vector>
#include <deque>
#include <algorithm>
#include <ctype.h>
#include <string>
#include <map>
#include <numeric>
#include <set>
#include <array>
#include <functional>
#include <cmath>
#include <cstring>
#include <locale>

using namespace std;

int main(){
    int t;
    cin >>t;
    while(t--){
        int n, x;
        cin >>n;
        vector<int> a;
        int ans=0;
        for(int i=0; i<n; i++){
            cin>>x;
            a.push_back(x);
        }
        sort(a.begin(), a.end());
        x=distance(a.begin(),unique(a.begin(), a.end()));
        if(x==n){
            if(abs(a[0]-a[1])>=abs(a[n]-a[n-1]))
                ans=abs(a[n]-a[n-1]);
            else ans=abs(a[0]-a[1]);
                cout << ans << "\n";
                }
        else cout << 0 << "\n";
    }
}


#include <cmath>
#include <iostream>
using namespace std;
void ReadData()
{
    unsigned int n;
    cin>>n;
    int a[51];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int d=a[1]-a[0];
    for(int i=1;i<n-1;i++)
    {
        if(d>a[i+1]-a[i])
        {
            d=a[i+1]-a[i];
        }
    }
    cout<<d<<endl;
}
int main()
{
    unsigned int m;
    cin>>m;
    for(int i=1;i<=m;i++)
    {
        ReadData();
    }
    return 0;
}


#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
void ReadData()
{
    unsigned int n;
    cin>>n;
    int a[51];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    int d=a[1]-a[0];
    for(int i=1;i<n-1;i++)
    {
        if(d>a[i+1]-a[i])
        {
            d=a[i+1]-a[i];
        }
    }
    cout<<d<<endl;
}
int main()
{
    unsigned int m;
    cin>>m;
    for(int i=1;i<=m;i++)
    {
        ReadData();
    }
    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int t;
    for(int j=0; j<t; j++)
    {
        int n, d=0, min=10000;
        cin>>n;
        vector <int> v;
        for(int i=0; i<n; i++)
        {
            int x;
            cin>>x;
            v.push_back(x);
        }
         sort(v.begin(), v.end());
        for(int i=0; i<n-1; i++)
        {
            d=v[i+1]-v[i];
            if(d<min)
            min=d;
            if(min==0)
            break;
        }
        cout<<min<<endl;
    }
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int t;
    for(int j=0; j<t; j++)
    {
        int n, d=0, min=10000;
        cin>>n;
        vector <int> v;
        for(int i=0; i<n; i++)
        {
            int x;
            cin>>x;
            v.push_back(x);
        }
        sort(v.begin(), v.end());
        for(int i=0; i<n-1; i++)
        {
            d=v[i+1]-v[i];
            if(d<min)
            min=d;
            if(min==0)
            break;
        }
        cout<<min<<endl;
    }
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
    int t;
    cin>>t;
    for(int j=0; j<t; j++)
    {
        int n, d=0, min=10000, x;
        cin>>n;
        vector <int> v;
        for(int i=0; i<n; i++)
        {
            cin>>x;
            v.push_back(x);
        }
         sort(v.begin(), v.end());
         //for(int i=0; i<n; i++)
         //cout<<v[i]<<" ";
         //cout<<endl;
        for(int i=0; i<n-1; i++)
        {
            d=v[i+1]-v[i];
            if(d<min)
            min=d;
            if(min==0)
            break;
        }
        cout<<min<<endl;
    }
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int t;
    for(int j=0; j<t; j++)
    {
        int n, d=0, min;
        cin>>n;
        vector <int> v;
        for(int i=0; i<n; i++)
        {
            int x;
            cin>>x;
            v.push_back(x);
        }
        sort(v.begin(), v.end());
        for(int i=0; i<n-1; i++)
        {
            d=v[i+1]-v[i];
            if(d<min)
            min=d;
            if(min==0)
            break;
        }
        cout<<min<<endl;
    }
}


#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int t;
    for(int j=0; j<t; j++)
    {
        int n, d=0, min;
        cin>>n;
        vector <int> v;
        for(int i=0; i<n; i++)
        {
            int x;
            cin>>x;
            v.push_back(x);
        }
        v.sort(v.begin(), v.end());
        for(int i=0; i<n-1; i++)
        {
            d=v[i+1]-v[i];
            if(d<min)
            min=d;
            if(min==0)
            break;
        }
        cout<<min<<endl;
    }
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;
int sample[55];

int main() {
	int t;
	scanf("%d", &t);
	while (t--) {
		int n;
		memset(sample, 0, sizeof(sample));
		scanf("%d", &n);
		for (int i = 1; i <= n; i++) {
			scanf("%d", &sample[i]);
		}
		int minm = 0x3f3f3f3f;
		sort(sample + 1, sample + 1 + n);
		for (int i = 2; i <= n; i++) {
			if (sample[i] - sample[i - 1] < minm) {
				minm = sample[i] - sample[i - 1];
			}
		}
		printf("%d\n", minm);
	}
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>

using namespace std;
int sampl[55];

int main() {
	int t;
	scanf("%d", &t);
	while (t--) {
		int n;
		memset(sampl, 0, sizeof(sampl));
		scanf("%d", &n);
		for (int i = 1; i <= n; i++) {
			scanf("%d", &sampl[i]);
		}
		int minm = 0x3f3f3f3f;
		sort(sampl + 1, sampl + 1 + n);
		for (int i = 2; i <= n; i++) {
			if (sampl[i] - sampl[i - 1] < minm) {
				minm = sampl[i] - sampl[i - 1];
			}
		}
		printf("%d\n", minm);
	}
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <utility>
#include <cmath>
#include <iomanip>
#include <queue>
#include <sstream>
#include <map>
typedef long long ll;

using namespace std;

int main()
{
	int t, n,k;
	vector <int> a;
	vector <int> b;
	cin >> t;
	while (t > 0) {
		cin >> n;
		for (int i = 0; i < n; i++) {
			cin >> k;
			a.push_back(k);
		}
		sort(a.begin(), a.end());
		for (int j = 1; j < n; j++) {
			b.push_back(a[j] - a[j - 1]);
		}
		sort(b.begin(), b.end());
		cout << b[0] << endl;
		a.clear();
		b.clear();
		t--;
	}
	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main(){

    int t;
    cin>>t;
    while(t--){

        int n;
        cin>>n;
        vector<int> v(n);

        for(int i=0;i<n;i++)
            cin>>v[i];
        sort(v.begin(),v.end());

        int mini = v[1]-v[0];

        for(int i=1;i<n;i++){
                if(mini>abs(v[i]-v[i-1]))
            mini = v[i]-v[i-1];
        }
        cout<<mini<<"\n";

    }

    return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int main(){

    int t;
    cin>>t;
    while(t--){

        int n;
        cin>>n;
        vector<int> v(n);

        for(int i=0;i<n;i++)
            cin>>v[i];
        sort(v.begin(),v.end());

        int mini = v[1]-v[0];

        for(int i=1;i<n;i++){
                if(min>v[i]-v[i-1])
            mini = v[i]-v[i-1];
        }
        cout<<mini<<"\n";

    }

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <iomanip>
#include <set>
#include <stack>

using namespace std;
#define ll long long

void solve() {
	int n;
	cin >> n;
	vector <int> v(n);
	for (int i = 0; i < n; i++) cin >> v[i];
	sort(v.begin(), v.end());
	int ans = 200000;
	for (int i = 1; i < n; i++) {
		ans = min(ans, v[i] - v[i - 1]);
	}
	cout << ans << endl;
}

int main()
{
	int t;
	cin >> t;
	while (t--) {
		solve();
	}
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[100];
        int i;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        int s,min=10000;
        for(i=0;i<l-1;i++)
        {
            s=a[i+1]-a[i];
            if(s<min)
            {
                min=s;
            }
        }
        cout<<min<<"\n";
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[100];
        int i;
        for(i=0;i<n;i++)
        {
            cin>>a[i];
        }
        sort(a,a+n);
        int s,min=10000;
        for(i=0;i<n-1;i++)
        {
            s=a[i+1]-a[i];
            if(s<min)
            {
                min=s;
            }
        }
        cout<<min<<"\n";
    }
}


using namespace std;
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <bitset>
#include <iterator>
#include <set>
#include <unordered_set>
#include <string>
#include <functional>
//#include <bits/stdc++.h>
//#include <list>
#include <stack>
#include <stdio.h>
typedef long long ll; //watch out ll= int*int will not become ll, rather (ll)ini*int casting will work
#include <queue>
#include <math.h>
#include <deque>
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#include <cmath>
#include <iomanip>
const long double PI = 3.141592653589793238L;

/*struct CustomCompare
{
	bool operator()(pii& p1, pii& p2)
	{
		if (p1.second - p1.first == p2.second - p2.first)
			return p1.first > p2.first;

		return p1.second - p1.first < p2.second - p2.first;
	}
};*/

int main() {
	//int n, k; cin >> n >> k;
	int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int n; cin >> n;
		vector<int> s(n);
		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		sort(s.begin(), s.end());
		int minn = 99999999;
		for (int i = 1; i < n; i++)
			minn = min(minn, s[i] - s[i - 1]);
		cout << minn << '\n';
	}
}
/*
ll n, k; cin >> n >> k;
		if (k == n) {
			cout << 1 << '\n'; continue;
		}
		ll start = k;
		if (n%2)
		//if (k >= sqrt(n))
		//	start = sqrt(n);
		while (true) {
			if (n % start == 0) {

				cout << n / start << '\n';
				break;
			}
			start--;
		}
*/

/*
int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int eve=0; int odd=0;
		int n; cin >> n;
		vector<int> s(n);
		for (int i = 0; i < n; i++) {
			int inp; cin >> inp;
			s[i] = inp;
			if (inp % 2 == 0)
				eve++;
			else
				odd++;
		}
		sort(s.begin(), s.end());
		bool f = false;
		for (int i = 1; i < n; i++)
			f |= (s[i] - s[i-1]) == 1;
		if (eve % 2 == 0 && odd % 2 == 0)
			cout << "YES \n";
		else if (eve % 2 == 1 && odd % 2 == 1 && f)
			cout << "YES \n";
		else
			cout << "NO \n";
	}

*/
/*
int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int a, b; cin >> a >> b;
		cout << min(pow(a + b, 2), pow(min(
			max(2 * a,b), max(2 * b,a)), 2));
		cout << endl;
	}
	*/
/*int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int n; cin >> n;
		vector<int> s(n);
		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		sort(s.begin(), s.end());
		int minn = 99999999;
		for (int i = 1; i < n; i++)
			minn = min(minn, s[i] - s[i - 1]);
		cout << minn<<'\n';
	}*/


using namespace std;
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <bitset>
#include <iterator>
#include <set>
#include <unordered_set>
#include <string>
#include <functional>
//#include <bits/stdc++.h>
//#include <list>
#include <stack>
#include <stdio.h>
typedef long long ll; //watch out ll= int*int will not become ll, rather (ll)ini*int casting will work
#include <queue>
#include <math.h>
#include <deque>
#define ffor(i,n) for(int i = 0;i < (n); ++i)
#define all(v) v.begin(),v.end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#include <cmath>
#include <iomanip>
const long double PI = 3.141592653589793238L;

/*struct CustomCompare
{
	bool operator()(pii& p1, pii& p2)
	{
		if (p1.second - p1.first == p2.second - p2.first)
			return p1.first > p2.first;

		return p1.second - p1.first < p2.second - p2.first;
	}
};*/

int main() {
	//int n, k; cin >> n >> k;
	int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int n; cin >> n;
		vector<int> s(n);
		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		sort(s.begin(), s.end());
		int minn = 99999999;
		for (int i = 1; i < n; i++)
			minn = min(minn, s[i] - s[i - 1]);
		cout << minn << '\n';
	}*
}
/*
ll n, k; cin >> n >> k;
		if (k == n) {
			cout << 1 << '\n'; continue;
		}
		ll start = k;
		if (n%2)
		//if (k >= sqrt(n))
		//	start = sqrt(n);
		while (true) {
			if (n % start == 0) {

				cout << n / start << '\n';
				break;
			}
			start--;
		}
*/

/*
int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int eve=0; int odd=0;
		int n; cin >> n;
		vector<int> s(n);
		for (int i = 0; i < n; i++) {
			int inp; cin >> inp;
			s[i] = inp;
			if (inp % 2 == 0)
				eve++;
			else
				odd++;
		}
		sort(s.begin(), s.end());
		bool f = false;
		for (int i = 1; i < n; i++)
			f |= (s[i] - s[i-1]) == 1;
		if (eve % 2 == 0 && odd % 2 == 0)
			cout << "YES \n";
		else if (eve % 2 == 1 && odd % 2 == 1 && f)
			cout << "YES \n";
		else
			cout << "NO \n";
	}

*/
/*
int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int a, b; cin >> a >> b;
		cout << min(pow(a + b, 2), pow(min(
			max(2 * a,b), max(2 * b,a)), 2));
		cout << endl;
	}
	*/
/*int t; cin >> t;
	for (int ttt = 0; ttt < t; ttt++) {
		int n; cin >> n;
		vector<int> s(n);
		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		sort(s.begin(), s.end());
		int minn = 99999999;
		for (int i = 1; i < n; i++)
			minn = min(minn, s[i] - s[i - 1]);
		cout << minn<<'\n';
	}*/


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<set>
#include<queue>
#include<math.h>
#include<fstream>
#include<cstring>
using namespace std;

int main() {
	int  t;
	cin >> t;
	while (t--)
	{
		int n;
		cin >> n;
		int s[100] = { 0 };

		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		sort(s, s + n);
		int ans = 0x3f3f3f;
		for (int i = 0; i < n-1; i++) {
			ans = min(ans, s[i + 1] - s[i]);
		}
		cout << ans << endl;
	}

	return 0;
}


#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stdio.h>
#include<set>
#include<queue>
#include<math.h>
#include<fstream>
#include<cstring>
using namespace std;

int main() {
	int  t;
	cin >> t;
	while (t--)
	{
		int n;
		cin >> n;
		int s[100] = { 0 };

		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		sort(s, s + n);
		if (n == 2) {
			cout << abs(s[0] - s[1]) << endl;
		}
		else {
			cout << min(abs(s[n / 2] - s[n / 2 + 1]), abs(s[n / 2] - s[n / 2 - 1])) << endl;
		}
	}

	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int min(int n,int a[]){
	sort(a,a+n);
	int min=a[1]-a[0];
	for(int i=0;i<n-1;i++){
			if(a[i+1]-a[i]<=min) min=a[i+1]-a[i];
		}
	return min;
	}
int main(){
	int t,n[1000],a[1000][50];
	cin>>t;
	for(int i=0;i<t;i++){
		cin>>n[i];
		for(int j=0;j<n[i];j++){
			cin>>a[i][j];
			}
		}
	for(int i=0;i<t;i++){
		int x=min(n[i],a[i]);
		cout<<x<<endl;
	}
}


#include <iostream>

using namespace std;

void solve() {
	int t, n;
	int s[50];
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> n;
		for (int j = 0; j < n; j++) {
			cin >> s[j];
		}
		for (int k = 0; k < n; k++) {
			for (int j = 0; j < n - 1; j++) {
				if (s[j] > s[j + 1]) {
					int temp = s[j];
					s[j] = s[j + 1];
					s[j + 1] = temp;
				}
			}
		}
		int j = 0;
		int k = n-1;
		int res = 1000000;
		while (j < k) {
			if (res > abs(s[k] - s[j]))
				res = abs(s[k] - s[j]);
			k--;
		}
		cout << res << endl;
	}
}

int main() {

	solve();
	return 0;
}


#include <iostream>

using namespace std;

void solve() {
	int t, n;
	int s[50];
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> n;
		for (int j = 0; j < n; j++) {
			cin >> s[j];
		}
		for (int k = 0; k < n; k++) {
			for (int j = 0; j < n - 1; j++) {
				if (s[j] > s[j + 1]) {
					int temp = s[j];
					s[j] = s[j + 1];
					s[j + 1] = temp;
				}
			}
		}
		cout << s[1]-s[0] << endl;
	}
}

int main() {

	solve();
	return 0;
}


#include <iostream>

using namespace std;

void solve() {
	int t, n;
	int s[50];
	cin >> t;
	for (int i = 0; i < t; i++) {
		cin >> n;
		for (int j = 0; j < n; j++) {
			cin >> s[j];
		}
		for (int k = 0; k < n; k++) {
			for (int j = 0; j < n - 1; j++) {
				if (s[j] > s[j + 1]) {
					int temp = s[j];
					s[j] = s[j + 1];
					s[j + 1] = temp;
				}
			}
		}
		int res = 1000000;
		for (int j = 0; j < n - 1; j++)
			for (int k = n - 1; k > j; k--)
				if (res > abs(s[k] - s[j]))
					res = abs(s[k] - s[j]);
		cout << res << endl;
	}
}

int main() {

	solve();
	return 0;
}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <bitset>
#include <fstream>
#include <cstdlib>
#include <functional>
#include <climits>
#include <queue>
#include <time.h>
#include <unordered_set>
#include <unordered_map>/
#include <stack>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define ll long long
#define magic_define ios_base::sync_with_stdio(false); cin.tie(NULL); cout << fixed; cout.precision(17);

using namespace std;

const int N = (int)100;
int n;
int a[N];

void solution() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	sort(a, a + n);
	int ans = INT_MAX;
	for (int i = 0; i < n - 1; ++i) {
		ans = min(ans, a[i + 1] - a[i]);
	}
	cout << ans << '\n';
}

int32_t main() {

	magic_define;

	int t;

	cin >> t;

	for (int i = 0; i < t; ++i) {
		solution();
	}

	return 0;

}


#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <bitset>
#include <fstream>
#include <cstdlib>
#include <functional>
#include <climits>
#include <queue>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#include <stack>

/*
 ░░░░░░░░░░░░░░░░▄▄▄▄▄▄░░░░░░░░░░░░░░░░
░░░░░░░░░░▄▄▄████████████▄▄▄░░░░░░░░░░
░░░░░░░▄▄████████████████████▄▄░░░░░░░
░░░░░▄███████████████▀▀▀████████▄░░░░░
░░░░██████████████████▄░░▀████████░░░░
░░▄████████▀░░░░░▄██████▄░░▀███████▄░░
░░███████▀░░░░░░█████████▄░░░███████░░
░███████▄░░░░░░░▀█████████░░░░███████░
░█████████▄▄██▄░░░▀████████░░░███████░
████████████████▄░░░▀█████▀░░░████████
██████████████████▄░░░▀███░░░░████████
░██████████▀░▀██████▄░░░▀░░░░████████░
░███████▀░░░░░░▀▀███▀▀░░░░░░█████████░
░░████▀░░░▄▄█▄▄░░░░░░░░░░░░░░▀██████░░
░░▀██░░░▄█████████▄▄▄▄████▄░░░░████▀░░
░░░░████████████████████████▄░▄███░░░░
░░░░░▀██████████████████████████▀░░░░░
░░░░░░░▀▀████████████████████▀▀░░░░░░░
░░░░░░░░░░▀▀▀████████████▀▀▀░░░░░░░░░░
░░░░░░░░░░░░░░░░▀▀▀▀▀▀░░░░░░░░░░░░░░░░
 [ЭТОТ КОД КРАЙНЕ НЕУСТОЙЧИВ]
 */

#pragma GCC optimize("Ofast,unroll-loops,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

#define ll long long
#define lld long long double
#define magic_define ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(27);
//#define int long long

int a[100];

void solve() {
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    int ans = INT_MAX;
    for (int i = 0; i < n - 1; ++i) {
        if (a[i + 1] - a[i] < ans) {
            ans = a[i + 1] - a[i];
        }
    }
    cout << ans << '\n';
}

int32_t main() {
    magic_define;
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


#include <iostream>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<list>
#include<vector>
#include <locale>
#include<algorithm>
#include<unordered_map>
#include <locale>
using namespace std;

int main()
{
	int t ,a,b ,res =100000 ,k;
	vector<int>v;
	cin >> t;
	for (int i = 0; i < t; i++) {
		res = 100000;
		cin >> a;
		k = a - 1;
		for (int j = 0; j < a; j++) {
			cin >> b;
			v.push_back(b);
		}
		sort(v.begin(), v.end());

		for (int j = 0; j < k; j++) {
			res = min(abs(v[j] - v[j + 1]), res);
		}
		cout << res<<endl;
		v.clear();

	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
	int t;
	std::cin >> t;

	while (t-- > 0)
	{
		int n;
		std::cin >> n;

		std::vector<int> s(n);
		for (auto &si: s)
			std::cin >> si;

		std::sort(s.begin(), s.end());
		int min = s[1] - s[0];
		for (int i = 2; i < n; ++i)
		{
			int diff = s[i] - s[i - 1];
			if (diff < min)
				min = diff;
		}

		std::cout << min << '\n';
	}

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <string>

using namespace std;

int main()
{
	int t, n, s, min;
	cin >> t;
	deque<int> teamA, teamB;
	while (t--) {
		cin >> n;
		while (n--) {
			cin >> s;
			teamB.push_back(s);
		}
		sort(teamB.begin(), teamB.end());
		bool iter1 = true;
		while (!teamB.empty()) {
			std::deque<int>::iterator it, it2;
			teamA.push_back(teamB.front());
			teamB.pop_front();
			for (it = teamA.begin(); it < teamA.end(); it++) {
				for (it2 = teamB.begin(); it2 < teamB.end(); it2++) {
					if (iter1) {
						iter1 = false;
						min = abs(*it - *it2);
					}
					else if (abs(*it - *it2) < min) {
						min = *it - *it2;
					}
				}
			}
		}
		while (!teamA.empty()) {
			teamA.pop_front();
		}
		cout << min << endl;
	}
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <string>

using namespace std;

int main()
{
	int t, n, s, min;
	cin >> t;
	deque<int> teamA, teamB;
	while (t--) {
		cin >> n;
		while (n--) {
			cin >> s;
			teamB.push_back(s);
		}
		sort(teamB.begin(), teamB.end());
		bool iter1 = true;
		while (!teamB.empty()) {
			std::deque<int>::iterator it, it2;
			teamA.push_back(teamB.front());
			teamB.pop_front();
			for (it = teamA.begin(); it < teamA.end(); it++) {
				for (it2 = teamB.begin(); it2 < teamB.end(); it2++) {
					if (iter1) {
						iter1 = false;
						min = abs(*it - *it2);
					}
					else if (abs(*it - *it2) < min) {
						min = abs(*it - *it2);
					}
				}
			}
		}
		while (!teamA.empty()) {
			teamA.pop_front();
		}
		cout << min << endl;
	}
}