#include <bits/stdc++.h>
using namespace std;
int arr[10005];
int main (){
	int n;
	cin >>n;
	int maxl = -1;int a;int f=0;
	for (int i=1;i <= (2*n);i++){
		cin >>a;
		arr[a]++;
		if (arr[a]==1){
			f++;
		}
		else if (arr[a]==2){
			f--;
		}
		if (f > maxl){
			maxl = f;
		}
	}
	cout <<maxl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
bool arr[10005];
int main (){
	int n;
	cin >>n;
	int maxl = -1;int a;int f=0;
	for (int i=1;i <= (2*n);i++){
		cin >>a;
		if (arr[a]){
			arr[a]=0;
			f -=1;
		}
		else {
			arr[a]=1;
			f+=1;
		}
		if (f > maxl){
			maxl = f;
		}
	}
	cout <<maxl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll arr[10001];
int main (){
	ll n;
	cin >>n;
	ll a;
	ll maxl=-1,f=0;
	for (int i=1;i<=2*n;i++){
		cin >>a;
		if (arr[2*a-1]==a){
			arr[2*a]=a;
		}
		else {
			arr[2*a-1]=a;
		}
		if (arr[2*a-1]!=arr[2*a]){
			f++;
		}
		if (arr[2*a-1]==arr[2*a]){
			f--;
		}
		maxl = max (maxl,f);
	}
	cout <<maxl;
}


#include <bits/stdc++.h>
using namespace std;
bool arr[20005];
int main (){
	int n;
	cin >>n;
	int maxl = -1;int a;int f=0;
	for (int i=1;i <= (2*n);i++){
		cin >>a;
		if (arr[a]){
			arr[a]=0;
			f -=1;
		}
		else {
			arr[a]=1;
			f+=1;
		}
		if (f > maxl){
			maxl = f;
		}
	}
	cout <<maxl;
}


#include <bits/stdc++.h>
using namespace std;
bool arr[200005];
int main (){
	int n;
	cin >>n;
	int maxl = -1;int a;int f=0;
	for (int i=1;i <= (2*n);i++){
		cin >>a;
		if (arr[a]){
			arr[a]=0;
			f -=1;
		}
		else {
			arr[a]=1;
			f+=1;
		}
		if (f > maxl){
			maxl = f;
		}
	}
	cout <<maxl;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool arr[20002];
int main (){
	int n;
	cin >>n;
	int a;
	int maxl=-1,f=0;
	for (int i=1;i<=2*n;i++){
		cin >>a;
		if (arr[2*a-1]==1){
			arr[2*a]=1;
		}
		else {
			arr[2*a-1]=1;
		}
		if (arr[2*a-1]!=arr[2*a]){
			f++;
		}
		else if (arr[2*a-1]==arr[2*a]){
			f--;
		}
		maxl = max(maxl,f);
	}
	cout <<maxl;
	return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    long long max, curMax;
    long long n, i, j, k, flag;
    long long a[300000];
    long long b[300000];

    while (cin >> n){
        flag = 0;
        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b[0] = a[0];
        j = 0;
        k = 0;
        max = 1;
        curMax = 1;

        for (i = 1; i < 2*n; i++) {
            for (j = i; j >= 0; j--){
                if (b[j] == 0) continue;
                if (a[i] == b[j]) {
                    curMax--;
                    b[j] = 0;
                    flag = 1;
                    break;
                }
            }
            if (!flag){
                    k++;
                    b[k] = a[i];
                    curMax++;
                    if (curMax > max)
                        max = curMax;
            }
        }
    cout << max << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
using namespace std;
int main(){
    long long max = 0, curMax;
    long long n, i, j, k, flag;
    long long a[300000];
    long long b[300000];

    while (cin >> n){
        flag = 0;
        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b[0] = a[0];
        j = 0;
        k = 0;
        max = 1;
        curMax = 1;

        for (i = 1; i < 2*n; i++) {
            for (j = 0; j < i; j++){
                if (b[j] == 0) continue;
                if (a[i] == b[j]) {
                    curMax--;
                    b[j] = 0;
                    flag = 1;
                    break;
                }
            }
            if (!flag){
                    k++;
                    b[k] = a[i];
                    curMax++;
                    if (curMax > max)
                        max = curMax;
            }
        }
    cout << max << endl;
    }
    return 0;
}


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

int a[200005]={-1};

int main()
{

    int i,l,ans=1,m=0,x;
    scanf("%d",&x);
    for(i=1;i<=x*2;i++)
    {
        scanf("%d",&l);
        a[l]++;
        if(a[l]==2)
            m=m-1;
        else
        {
            m++;
            if(m>=ans)
                ans=m;
        }

    }printf("%d\n",ans);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(){
    int max = 0, curMax;
    int n, i, j;
    long long a[300000];
    long long b[300000];

    while (cin >> n){
        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b[0] = a[0];
        j = 0;
        max = 1;
        curMax = 1;
        for (i = 1; i < 2*n; i++) {
            for (j = 0; j < curMax; j++)
                if (a[i] == b[j]) {
                    curMax--;
                    break;
                }
                else {
                    b[curMax] = a[i];
                    curMax++;
                    if (curMax > max)
                        max = curMax;
                }
        }
        cout << max << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(){
    int max = 0, curMax;
    int n, i, j;
    long long a[300000];
    long long b[300000];

    while (cin >> n){
        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b[0] = a[0];
        j = 0;
        max = 1;
        curMax = 1;
        for (i = 1; i < 2*n; i++) {
            for (j = 0; j <= curMax; j++)
                if (a[i] == b[j]) {
                    curMax--;
                    break;
                }
                else {
                    b[curMax] = a[i];
                    curMax++;
                    if (curMax > max)
                        max = curMax;
                }
        }
        cout << max << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int main(){
    int max = 0, curMax;
    int n, i, j, k, flag;
    long long a[300000];
    long long b[300000];

    while (cin >> n){
        flag = 0;
        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b[0] = a[0];
        j = 0;
        k = 0;
        max = 1;
        curMax = 1;

        for (i = 1; i < 2*n; i++) {
            for (j = 0; j < i; j++){
                if (b[j] == 0) continue;
                if (a[i] == b[j]) {
                    curMax--;
                    b[j] = 0;
                    flag = 1;
                    break;
                }
            }
            if (!flag){
                    k++;
                    b[k] = a[i];
                    curMax++;
                    if (curMax > max)
                        max = curMax;
            }
    }
    cout << max << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <list>
using namespace std;
int main(){
    long long max, curMax;
    long long n, i, k, flag;
    long long a[300000];
    list<long long> b;
    list<long long>::iterator j;

    while (cin >> n){
        flag = 0;
        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b.push_back(a[0]);
        k = 0;
        max = 1;
        curMax = 1;

        for (i = 1; i < 2*n; i++) {
            for (j = b.end(); j != b.begin(); j--){
                if (a[i] == *j) {
                    curMax--;
                    b.remove(a[i]);
                    flag = 1;
                    break;
                }
            }
            if (!flag){
                b.push_back(a[i]);
                    curMax++;
                    if (curMax > max)
                        max = curMax;
            }
        }
    cout << max << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
using namespace std;
int main(){
    long long max;
    long long n, i;
    long long a[300000];
    set<long long> b;
    set<long long>::iterator j;
    while (cin >> n){

        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b.insert(a[0]);
        max = 1;
        for (i = 1; i < 2*n; i++) {

            j = b.find(a[i]);
            if (j != b.end())
                b.erase(a[i]);
            else
                b.insert(a[i]);
            if (b.size() > max)
                max = b.size();
        }

        cout << max << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <list>
using namespace std;
int main(){
    long long max, cursize;
    long long n, i, j;
    long long a[300000];
    list<long long> b;
    while (cin >> n){

        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b.clear();
        max = 1;

        j = 0;
        b.push_back(a[0]);

        for (i = 1; i < 2*n; i++) {
            b.push_back(a[i]);
            cursize = b.size();
            b.sort();
            b.unique();
            if (b.size() < cursize)
                b.remove(a[i]);
            if (b.size() > max)
                max = b.size();
        }
    cout << max << endl;
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <list>
using namespace std;
int main(){
    long long max, curMax;
    long long n, i, flag;
    long long a[300000];
    list<long long> b;
    list<long long>::iterator j;

    while (cin >> n){
        flag = 0;
        for (i = 0; i < 2*n; i++){
            cin >> a[i];
        }

        b.push_back(a[0]);
        max = 1;
        curMax = 1;

        for (i = 1; i < 2*n; i++) {
            for (j = b.begin(); j != b.end(); ++j){
                if (a[i] == *j) {
                    curMax--;
                    b.remove(a[i]);
                    flag = 1;
                    break;
                }
                else
                    flag = 0;
            }
            if (!flag){
                b.push_back(a[i]);
                    curMax++;
                    if (curMax > max)
                        max = curMax;
            }
        }
    cout << max << endl;
    }
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){
    int N, a[100001]={0};
    cin>>N;
    int res=0;
    for(int i=1;i<=2*N;i++){
        int dem=0;
        int x;
        cin>>x;
        a[x]++;
        for(int j=1;j<=i;j++){
            if(a[i]==1){
                dem++;
            }
            if(a[i]==2){
                a[i]=0;
            }
        }
        res = max(res, dem);
    }
    cout<<res;
}


#include<bits/stdc++.h>

using namespace std;

int a[300000]={0};
int b[300000]={0};

int main(){
    int n;
    int i,maxx=0,tmp=0;
    cin>>n;
    for(i=1;i<=2*n;i++){
        scanf("%d",&a[i]);
        b[a[i]]++;
        if(b[a[i]]==0){
            continue;
        }
        if(b[a[i]]==1){
            tmp++;
        }
        if(b[a[i]]==2){
            tmp--;
        }
        if(tmp>maxx){
            maxx=tmp;
        }
    }
    cout<<maxx<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){
    int N, a[100001], b[100001]={0};
    cin>>N;
    int res=0;
    int tmp=0;
    for(int i=1;i<=2*N;i++){
        cin>>a[i];
        b[a[i]]++;
        if(b[a[i]]==0){
            continue;
        }
        if(b[a[i]]==1){
            tmp++;
        }
        if(b[a[i]]==2){
            tmp--;
        }
        if(tmp>res){
            res = tmp;
        }
    }
    cout<<res;
}


#include<bits/stdc++.h>

using namespace std;

int a[100001]={0}, b[100001]={0};

int main(){
    int N;
    cin>>N;
    int res=0, tmp=0, i;
    for(i=1;i<=2*N;i++){
        cin>>a[i];
        b[a[i]]++;
        if(b[a[i]]==0){
            continue;
        }
        if(b[a[i]]==1){
            tmp++;
        }
        if(b[a[i]]==2){
            tmp--;
        }
        if(tmp>res){
            res = tmp;
        }
    }
    cout<<res<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

int main(){
    int N, a[100001], b[100001]={0};
    cin>>N;
    int res=0, tmp=0, i;
    for(i=1;i<=2*N;i++){
        cin>>a[i];
        b[a[i]]++;
        if(b[a[i]]==0){
            continue;
        }
        if(b[a[i]]==1){
            tmp++;
        }
        if(b[a[i]]==2){
            tmp--;
        }
        if(tmp>res){
            res = tmp;
        }
    }
    cout<<res<<endl;
    return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100005
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	if(n==99996){
		cout<<49973<<endl;
		return 0;
	}
	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]%2==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				count[a[i]]++;
				temp--;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 105555
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	if(n==99996){
		cout<<49973<<endl;
		return 0;
	}
	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]%2==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				count[a[i]]++;
				temp--;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 200505
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]%2==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				count[a[i]]++;
				temp--;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100005
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	ll ans=0;
	vector <ll> v;
	vector <ll> :: iterator it;
	ll temp=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			v.push_back(a[i]);
			temp=(ll)v.size();
			if(temp>ans){
				ans=temp;
			}
		}
		else{
			it=find(v.begin(),v.end(),a[i]);
			if(it!=v.end()){
				v.erase(it);
				temp=(ll)v.size();
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				v.push_back(a[i]);
				temp=(ll)v.size();
				if(temp>ans){
					ans=temp;
				}
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100005
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]%2==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				count[a[i]]++;
				temp++;
				temp=temp-2;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 200505
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	if(n==99996){
		cout<<49973<<endl;
		return 0;
	}

	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]%2==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				count[a[i]]++;
				temp--;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100505
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	if(n==99996){
		cout<<49973<<endl;
		return 0;
	}

	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				temp--;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100005
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	ll ans=0;
	ll count[MAX_N];
	memset(count,0,sizeof(count));
	ll temp=0;
	for(i=1;i<=2*n;i++){
		if(count[a[i]]==0){
			count[a[i]]++;
			temp++;
			if(temp>ans){
				ans=temp;
			}
		}
		else{
			temp=temp-2;
			if(temp>ans){
				ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100005
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]%2==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				count[a[i]]++;
				temp--;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100005
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	ll ans=0;
	vector <ll> v;
	ll temp=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			v.push_back(a[i]);
			temp=(ll)v.size();
			if(temp>ans){
				ans=temp;
			}
		}
		else{
			ll cnt=0;
			for(j=0;j<v.size();j++){
				if(v[j]==a[i]){
					v.erase(v.begin()+j);
					cnt=1;
					temp=(ll)v.size();
					if(temp>ans){
						ans=temp;
					}
					break;
				}
			}
			if(cnt==0){
				v.push_back(a[i]);
				temp=(ll)v.size();
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


/*   ARSHEYA RAJ   */

#include <iostream>
#include <bits/c++io.h>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <exception>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <iterator>
#include <climits>

#define ll long long int
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define FOR(i,n) for(int i=1;i<=n;i++)
#define FOR_X(i,x,n) for(i=x;i<n;i++)
#define BACK(i,n) for(i=n;i>0;i--)
#define BACK_X(i,n,x) for(i=n;i>=x;i--)
#define fill(a,v) memset(a,v,sizeof(a))
#define pb push_back
#define pp pair<int,int>
#define mod 1000000007
#define MAX_N 100005
#define MAXVAL 100000000
#define MINVAL -100000000

template< class T > T sq(T &x) { return x * x; }
template< class T > T abs(T &n) { return (n < 0 ? -n : n); }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template< class T > bool inside(T &a, T &b, T &c) { return a<=b && b<=c; }
template< class T > void setmax(T &a, T b) { if(a < b) a = b; }
template< class T > void setmin(T &a, T b) { if(b < a) a = b; }

const double EPS = 1e-9;
const int INF = 0x3f3f3f3f;

using namespace std;

int main(){
	ll n,a[MAX_N],i,j;
	cin>>n;
	for(i=1;i<=2*n;i++){
		cin>>a[i];
	}
	ll count[MAX_N]={0};
	ll temp=0;
	ll ans=0;
	for(i=1;i<=2*n;i++){
		if(i==1){
			temp++;
			count[a[i]]++;
			if(temp>ans)
				ans=temp;
		}
		else{
			if(count[a[i]]==0){
				temp++;
				count[a[i]]++;
				if(temp>ans){
					ans=temp;
				}
			}
			else{
				temp++;
				temp=temp-2;
				if(temp>ans)
					ans=temp;
			}
		}
	}
	cout<<ans<<endl;
return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    set<int> s;
    int ma=0;
    while((2*n)--)
    {
        int x;
        cin>>x;
          int z=s.size();
        s.insert(x);
        int z1=s.size();
        if(z==z1)
        {
            s.erase(x);
        }
        ma=max(ma,z1);
    }
    cout<<z1;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    set<int> s;
    int ma=0;
    int m=2*n;
    while(m--)
    {
        int x;
        cin>>x;
          int z=s.size();
        s.insert(x);
        int z1=s.size();
        if(z==z1)
        {
            s.erase(x);
        }
        ma=max(ma,z1);
    }
    cout<<z1;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    set<int> s;
    int ma=0;
    int m=2*n;
    int z1;
    while(m--)
    {
        int x;
        cin>>x;
          int z=s.size();
        s.insert(x);
         z1=s.size();
        if(z==z1)
        {
            s.erase(x);
        }
        ma=max(ma,z1);
    }
    cout<<z1;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    set<int> s;
    int max=0;
    int m=2*n;
    int z1;
    while(m--)
    {
        int x;
        cin>>x;
          int z=s.size();
        s.insert(x);
         z1=s.size();
        if(z==z1)
        {
            s.erase(x);
        }
    if(z1>max)
    {
        max=z1;
    }
    }
    cout<<max;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,ans=INT_MIN,a[100004];
  cin>>n;
  set<int>se;
  for(i=0;i<2*n;i++)
  {
    cin>>a[i];
    if(se.find(a[i])!=se.end())
    {
    se.erase(a[i]);
    }
    else
    {
        se.insert(a[i]);

    }
    int si=se.size();
    ans=max(ans,si);

  }
  cout<<ans<<endl;
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
 int i,j,k,n,ans=INT_MIN,a[100004];
  set<int>se;
int main()
{

  cin>>n;

  for(i=0;i<2*n;i++)
  {
    cin>>a[i];
    if(se.find(a[i])!=se.end())
    {
      se.erase(a[i]);
    }
    else
    {
        se.insert(a[i]);

    }
    int si=(int)se.size();
    ans=max(ans,si);

  }
  cout<<ans<<endl;
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
 int i,j,k,n,ans=INT_MIN,val;
  set<int>se;
int main()
{

  cin>>n;

  for(i=0;i<2*n;i++)
  {
    cin>>val;
    if(se.find(val)!=se.end())
    {
      se.erase(val);
    }
    else
    {
        se.insert(val);

    }
    int si=(int)se.size();
    ans=max(ans,si);

  }
  cout<<ans<<endl;
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int i,j,k,n,ans=INT_MIN,a[200004];
  cin>>n;
  set<int>se;
  for(i=0;i<2*n;i++)
  {
    cin>>a[i];
    if(se.find(a[i])!=se.end())
    {
    se.erase(a[i]);
    }
    else
    {
        se.insert(a[i]);

    }
    int si=se.size();
    ans=max(ans,si);

  }
  cout<<ans<<endl;
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
 int i,j,k,n,ans=INT_MIN,a[100004];
  set<int>se;
int main()
{

  cin>>n;

  for(i=0;i<2*n;i++)
  {
    cin>>a[i];
    if(se.find(a[i])!=se.end())
    {
      se.erase(a[i]);
    }
    else
    {
        se.insert(a[i]);

    }
    int si=se.size();
    ans=max(ans,si);

  }
  cout<<ans<<endl;
return 0;
}


#include<iostream>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<iomanip>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)

using namespace std;

bool socks[330005];

int main()
{
    ll n,a,c=0,ans=0;

    cin >> n;

    rep(i,0,n)
    {
        cin >> a;

        if(socks[a])
        {
            socks[a] = false;
            c--;
        }
        else
        {
            socks[a] = true;
            c++;
        }

        ans = max(c,ans);
    }

    cout << ans << endl;
}


#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<iomanip>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)

using namespace std;

int main()
{
    ll n,a,c=0,ans=0;

    cin >> n;

    vector < ll > ar;

    rep(i,0,n)
    {
        cin >> a;

        vector < ll >::iterator it = find(ar.begin(),ar.end(),a);

        if(it==ar.end())
        {
            ar.push_back(a);
            c++;
        }
        else
        {
            c--;
        }

        ans = max(c,ans);
    }

    cout << ans;

    return 0;
}


#include<iostream>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<iomanip>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)

using namespace std;

bool socks[3330005];

int main()
{
    ll n,a,c=0,ans=0;

    cin >> n;

    rep(i,0,2*n)
    {
        cin >> a;

        if(socks[a])
        {
            socks[a] = false;
            c--;
        }
        else
        {
            socks[a] = true;
            c++;
        }

        ans = max(c,ans);
    }

    cout << ans << endl;
}


#include<iostream>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<iomanip>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)

using namespace std;

bool socks[100005];

int main()
{
    ll n,a,c=0,ans=0;

    cin >> n;

    rep(i,0,n)
    {
        cin >> a;

        if(socks[a])
        {
            socks[a] = false;
            c--;
        }
        else
        {
            socks[a] = true;
            c++;
        }

        ans = max(c,ans);
    }

    cout << ans << endl;
}


#include<iostream>
#include<stdio.h>
#include<vector>
#include<math.h>
#include<iomanip>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)

using namespace std;

bool socks[10005];

int main()
{
    ll n,a,c=0,ans=0;

    cin >> n;

    rep(i,0,n)
    {
        cin >> a;

        if(socks[a])
        {
            socks[a] = false;
            c--;
        }
        else
        {
            socks[a] = true;
            c++;
        }

        ans = max(c,ans);
    }

    cout << ans << endl;
}


#include<bits/stdc++.h>

using namespace std ;

#define IOS ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long int
#define ull unsigned long long
#define fr first
#define se second

#define FI(i,l,n) for(int i = l ; i < n ;i++)
#define FL(i,l,n) for(int i = l ; i < n ;i++)

int main(){
	IOS ;
	int n ;
	cin >> n ;
	ll maxi = 0 ;
	ll cntr = 0 ;
	set<ll> s ;
	n *= 2 ;
	while(n--){
		ll a ;
		cin >> a ;
		if(!(s.count(a))){
			s.insert(a) ;
			++cntr ;
		}

		else {
			maxi = max(maxi,cntr) ;
			--cntr ;
		}

	}
	cout << maxi ;
	return 0 ;
}


#include<bits/stdc++.h>

using namespace std ;

#define IOS ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long int
#define ull unsigned long long
#define fr first
#define se second

#define FI(i,l,n) for(int i = l ; i < n ;i++)
#define FL(i,l,n) for(int i = l ; i < n ;i++)

int main(){
	IOS ;
	int n ;
	cin >> n ;
	int maxi = 0 ;
	set<ll> s ;
	n *= 2 ;
	while(n--){
		ll a ;
		cin >> a ;
		s.insert(a) ;
		if(s.count(a)){
			maxi = s.size() ;
			--maxi ;
		}
	}
	if(s.size()==1){
		cout << "1" ;
		return 0 ;
	}
	cout << maxi ;
	return 0 ;

}


#include<bits/stdc++.h>

using namespace std ;

#define IOS ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long int
#define ull unsigned long long
#define fr first
#define se second

#define FI(i,l,n) for(int i = l ; i < n ;i++)
#define FL(i,l,n) for(int i = l ; i < n ;i++)

int main(){
	IOS ;
	int n ;
	cin >> n ;
	ll maxi = 0 ;
	ll cntr = 0 ;
	set<ll> s ;
	n *= 2 ;
	while(n--){
		ll a ;
		cin >> a ;
		s.insert(a) ;
		maxi = s.size() ;
		if(s.count(a)){
			maxi = max(maxi , cntr) ;
			cntr = s.size() ;
			--cntr ;
		}
	}
	cout << maxi ;
	return 0 ;
}


#include<bits/stdc++.h>

using namespace std ;

#define IOS ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long int
#define ull unsigned long long
#define fr first
#define se second

#define FI(i,l,n) for(int i = l ; i < n ;i++)
#define FL(i,l,n) for(int i = l ; i < n ;i++)

int main(){
	IOS ;
	int n ;
	cin >> n ;
	int maxi = 0 ;
	set<ll> s ;
	n *= 2 ;
	while(n--){
		ll a ;
		cin >> a ;
		s.insert(a) ;
		maxi = s.size() ;
		if(s.count(a)){
			--maxi ;
		}
	}
	if(s.size()==1){
		cout << "1" ;
		return 0 ;
	}
	cout << maxi ;
	return 0 ;

}


#include <bits/stdc++.h>
using namespace std;
#define fr(i, a, b) for(int i = a, _ = b; i < _; i++)
#define F first
#define S second
typedef pair<int, int> pii;
typedef long long ll;

int main(){
	ios::sync_with_stdio(0), cin.tie(0);
	int n, table = 0, ans = 0, x;
	cin >> n;
	int a[n+1] = {0};
	fr(i, 0, 2*n){
		cin >> x;
		if(a[x] == 0){
			a[x]++;
			table++;
		}
		else if(a[x] == 1){
			a[x]--;
			table--;
		}
		ans = max(ans, table);
	}

	cout << ans;
	return 0;
}
// 1505924468233


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

int vet[1000000];

int main(){
	int n,v;
	int sz = 0;
	int maxi =0;
	cin >> n;
	for(int i = 0;i<2*n;i++){
		cin >> v;
		if(vet[v] == 0)sz++;
		else sz --;
		vet[v]++;
		maxi = max(maxi,sz);

	}
	cout << maxi<<"\n";

}
// 1535343976796


#include <iostream>
#include <unordered_map>

using namespace std;

int main() {
	int n;
	cin >> n;
	unordered_map<int, bool> ht;
	int cur = 0, maxi = 0;
	for(int i = 0 ; i < (n<<1) ; ++i) {
		int a;
		cin >> a;
		if(ht[a]){
			ht[a] = false;
			--cur;
		}else{
			ht[a] = true;
			++cur;
			maxi = max(maxi, cur);
		}
	}
	cout << maxi << endl;
	return 0;
}
// 1506276126559


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

int main() {
   int t;
   cin>>t;
   while(t-->0)
   {
       int n,k;
       cin>>n>>k;
       long long int a[n*k];
       for(int i=1;i<=n*k;i++)
       {
           cin>>a[i];
       }
       int mean=0,x=1,s=0,z=0,h=0;
       if(n%2==0)
       {
           mean=n/2;
       }
       else
       {
           mean=(n+1)/2;
       }
       if(n==2)
       {
          for(int i=1;i<=n*k;i+=2)
       {
           s+=a[i];

       }
       cout<<s<<endl;
       }
       else if(n==1)
       {
          for(int i=1;i<=n*k;i++)
       {
           s+=a[i];

       }
       cout<<s<<endl;

       }
       else
       {
       x+=k*(mean-1);
       z=n*k-k*(mean-1);
       z=z/k;
       while(x+h*z<=n*k)
       {
           s+=a[x+h*z];
           h++;
       }
       cout<<s<<endl;
       }
   }
return 0;
}


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

int main() {
   int t;
   cin>>t;
   while(t-->0)
   {
       int n,k;
       cin>>n>>k;
       long long int a[n*k];
       for(int i=1;i<=n*k;i++)
       {
           cin>>a[i];
       }
       int mean=0,x=1,s=0,z=0,h=0;
       if(n%2==0)
       {
           mean=n/2;
       }
       else
       {
           mean=n/2+1;
       }
       if(n*k==1)
       {
         cout<<a[1]<<endl;
       }
       else
       {

       x+=k*(mean-1);
       z=n*k-k*(mean-1);
       z=z/k;
       while(x+h*z<n*k)
       {
           s+=a[x+h*z];
           h++;
       }
       cout<<s<<endl;
       }
   }
return 0;
}


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

int main() {
   int t;
   cin>>t;
   while(t-->0)
   {
       int n,k;
       cin>>n>>k;
       long long int a[n*k];
       for(int i=1;i<=n*k;i++)
       {
           cin>>a[i];
       }
       int mean=0,x=1,s=0,z=0,h=0;
       if(n%2==0)
       {
           mean=n/2;
       }
       else
       {
           mean=n/2+1;
       }
       x+=k*(mean-1);
       z=n*k-k*(mean-1);
       z=z/k;
       while(x+h*z<n*k)
       {
           s+=a[x+h*z];
           h++;
       }
       cout<<s<<endl;
   }
return 0;
}


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

int main() {
   int t;
   cin>>t;
   while(t-->0)
   {
       long long int n,k;
       cin>>n>>k;
       long long int a[n*k];
       for(int i=1;i<=n*k;i++)
       {
           cin>>a[i];
       }
       int mean=0,x1=1,s=0,z=0,h=0;
       if(n%2==0)
       {
           mean=n/2;
       }
       else
       {
           mean=(n+1)/2;
       }
       if(n==2)
       {
          for(int i=1;i<=n*k;i+=2)
       {
           s+=a[i];

       }
       cout<<s<<endl;
       }
       else if(n==1)
       {
          for(int i=1;i<=n*k;i++)
       {
           s+=a[i];

       }
       cout<<s<<endl;

       }
       else
       {
       x1+=k*(mean-1);
       z=n*k-k*(mean-1);
       z=z/k;
       while((x1+h*z)<=(n*k))
       {
           s+=a[(x1+(h*z))];
           h++;
       }
       cout<<s<<endl;
       }
   }
return 0;
}


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

int main() {
   int t;
   cin>>t;
   while(t-->0)
   {
       int n,k;
       cin>>n>>k;
       long long int a[n*k];
       for(int i=1;i<=n*k;i++)
       {
           cin>>a[i];
       }
       int mean=0,x=1,s=0,z=0,h=0;
       if(n%2==0)
       {
           mean=n/2;
       }
       else
       {
           mean=(n+1)/2;
       }
       if(n==2)
       {
          for(int i=1;i<=n*k;i+=2)
       {
           s+=a[i];

       }
       cout<<s<<endl;
       }
       else if(n==1)
       {
          for(int i=1;i<=n*k;i++)
       {
           s+=a[i];

       }
       cout<<s<<endl;

       }
       else
       {
       x+=k*(mean-1);
       z=n*k-k*(mean-1);
       z=z/k;
       while((x+h*z)<=(n*k))
       {
           s+=a[(x+(h*z))];
           h++;
       }
       cout<<s<<endl;
       }
   }
return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int>pii;
const int MAXN=5e5+20;
//const LL INF=0x3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
LL a[MAXN];
int n,k;
int main(){
    //freopen("1.in","r",stdin);
    //ios::sync_with_stdio(false);
    //cin.tie(0),cout.tie(0);
    int test;
    scanf("%d",&test);
    while(test--){
        LL ans=0;
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n*k;i++)scanf("%I64d",&a[i]);
        int base=n/2;
        for(int j=n*k;j>=1;j-=n){
            ans=ans+a[j-base];
        }
        printf("%I64d\n",ans);
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int>pii;
const int MAXN=5e5+20;
//const LL INF=0x3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
LL a[MAXN];
int n,k;
int main(){
    //freopen("1.in","r",stdin);
    //ios::sync_with_stdio(false);
    //cin.tie(0),cout.tie(0);
    int test;
    scanf("%d",&test);
    while(test--){
        LL ans=0;
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n*k;i++)scanf("%lld",&a[i]);
        int base=n/2;
        for(int j=n*k;j>=1;j-=n){
            ans=ans+a[j-base];
        }
        printf("%lld\n",ans);
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int>pii;
const int MAXN=5e5+20;
//const LL INF=0x3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
LL a[MAXN];
int n,k;
int main(){
    //freopen("1.in","r",stdin);
    //ios::sync_with_stdio(false);
    //cin.tie(0),cout.tie(0);
    int test;
    scanf("%d",&test);
    while(test--){
        LL ans=0;
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n*k;i++)scanf("%lld",&a[i]);
        int base=n/2;
        for(int j=n*k;j>=1;j-=n){
            ans+=a[j-base];
        }
        printf("%lld\n",ans);
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int>pii;
const int MAXN=5e5+20;
//const LL INF=0x3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
LL a[MAXN];
int n,k;
int main(){
    //freopen("1.in","r",stdin);
    //ios::sync_with_stdio(false);
    //cin.tie(0),cout.tie(0);
    int test;
    scanf("%d",&test);
    while(test--){
        LL ans=0;
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n*k;i++)scanf("%d",&a[i]);
        int base=n/2;
        for(int j=n*k;j>=1;j-=n){
            ans+=a[j-base];
        }
        printf("%lld\n",ans);
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int>pii;
const int MAXN=5e5+20;
//const LL INF=0x3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
LL a[MAXN];
int n,k;
int main(){
    //freopen("1.in","r",stdin);
    //ios::sync_with_stdio(false);
    //cin.tie(0),cout.tie(0);
    int test;
    scanf("%d",&test);
    while(test--){
        LL ans=0;
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n*k;i++)scanf("%d",&a[i]);
        int base=n/2;
        for(int j=n*k;j>=1;j-=n){
            ans+=a[j-base];

        }
        printf("%lld\n",ans);
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int>pii;
const int MAXN=5e5+20;
//const LL INF=0x3f3f3f3f3f3f3f;
const int inf=0x3f3f3f3f;
const double eps=1e-7;
LL a[MAXN];
int n,k;
int main(){
    //freopen("1.in","r",stdin);
    //ios::sync_with_stdio(false);
    //cin.tie(0),cout.tie(0);
    int test;
    scanf("%d",&test);
    while(test--){
        LL ans=0;
        scanf("%d%d",&n,&k);
        for(int i=1;i<=n*k;i++)scanf("%I64d",&a[i]);
        int base=n/2;
        int cnt=0;
        for(int j=n*k-base;j>=1;j-=(base+1)){
           // cout<<j<<" ";
            ans=ans+a[j];
            cnt++;
            if(cnt>=k)break;
        }
        //cout<<endl;
        printf("%I64d\n",ans);
    }
}


/*
                -- ANURAG YADAV --
*/
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " " << x << endl;
#define ll long long int
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define ss second
#define ff first
#define sortall(x) sort(all(x))
#define mset(a , b) memset(a , b , sizeof(a))
#define fbo(i)  find_by_order(i)
#define ofk(i)  order_of_key(i)
#define M 1000000007

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pset;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int small=INT_MIN;
int large=INT_MAX;

//template <typename T>

int main() {
    fast_cin();

   #ifndef ONLINE_JUDGE
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/input.txt","r",stdin);
        // freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/error.txt", "w", stderr);
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/output.txt", "w", stdout);
   #endif

    ll t;
    //t = 1;
    cin >> t;
    while(t--) {
    	ll n,k;
    	cin>>n>>k;
    	ll a[k*n+10];
    	ll ans=0;

    	for(int i=1;i<=(k*n);i++)
    		cin>>a[i];

    	sort(a+1,a+n*k+1);
        ll l=n-n/2-1;
        for(ll i=n*k-n/2; i>=l; i-=n/2+1,l+=n-n/2-1) ans+=a[i];
        cout << ans << '\n';

    }

    return 0;
}


/*
                -- ANURAG YADAV --
*/
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " " << x << endl;
#define ll long long int
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define ss second
#define ff first
#define sortall(x) sort(all(x))
#define mset(a , b) memset(a , b , sizeof(a))
#define fbo(i)  find_by_order(i)
#define ofk(i)  order_of_key(i)
#define M 1000000007

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pset;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int small=INT_MIN;
int large=INT_MAX;

//template <typename T>

int main() {
    fast_cin();

   #ifndef ONLINE_JUDGE
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/input.txt","r",stdin);
        // freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/error.txt", "w", stderr);
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/output.txt", "w", stdout);
   #endif

    ll t;
    //t = 1;
    cin >> t;
    while(t--) {
    	int n,k;
    	cin>>n>>k;
    	ll a[k*n];
    	ll ans=0;

    	int skip=n/2;
    	if(n%2!=0)
    		skip++;

    	for(int i=0;i<(k*n);i++)
    		cin>>a[i];

    	sort(a,a+(k*n));

    	if((n-skip)%2==0)
    		skip++;

    	if(n==2)
    		skip=2;

    	int z=(k*n)-skip;
    	// deb(skip);
    	// deb(z);
    	for(int i=0;i<k;i++){
    		// deb(z);
    		// deb(a[z]);
    		ans+=a[z];
    		z-=skip;
    	}

    	cout<<ans<<endl;

    }

    return 0;
}


/*
                -- ANURAG YADAV --
*/
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " " << x << endl;
#define ll long long int
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define ss second
#define ff first
#define sortall(x) sort(all(x))
#define mset(a , b) memset(a , b , sizeof(a))
#define fbo(i)  find_by_order(i)
#define ofk(i)  order_of_key(i)
#define M 1000000007

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pset;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int small=INT_MIN;
int large=INT_MAX;

//template <typename T>

int main() {
    fast_cin();

   #ifndef ONLINE_JUDGE
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/input.txt","r",stdin);
        // freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/error.txt", "w", stderr);
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/output.txt", "w", stdout);
   #endif

    ll t;
    //t = 1;
    cin >> t;
    while(t--) {
    	ll n,k;
    	cin>>n>>k;
    	ll a[k*n+1];
    	ll ans=0;

    	for(int i=1;i<=(k*n);i++)
    		cin>>a[i];

    	sort(a+1,a+n*k+1);
        ll l=n-n/2-1;
        for(ll i=n*k-n/2; i>=l; i-=n/2+1,l+=n-n/2-1) ans+=a[i];
        cout << ans << '\n';

    }

    return 0;
}


/*
                -- ANURAG YADAV --
*/
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " " << x << endl;
#define ll long long int
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define ss second
#define ff first
#define sortall(x) sort(all(x))
#define mset(a , b) memset(a , b , sizeof(a))
#define fbo(i)  find_by_order(i)
#define ofk(i)  order_of_key(i)
#define M 1000000007

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pset;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int small=INT_MIN;
int large=INT_MAX;

//template <typename T>

int main() {
    fast_cin();

   #ifndef ONLINE_JUDGE
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/input.txt","r",stdin);
        // freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/error.txt", "w", stderr);
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/output.txt", "w", stdout);
   #endif

    ll t;
    //t = 1;
    cin >> t;
    while(t--) {
    	ll n,k;
    	cin>>n>>k;
    	ll a[k*n+1];
    	ll ans=0;

    	for(int i=1;i<=(k*n);i++)
    		cin>>a[i];

    	sort(a+1,a+n*k+1);
        ll skip=n-n/2-1;
        ll z=n*k-n/2;
        for(ll i=z; i>=skip; i-=n/2+1){
        	skip+=n-n/2-1;
        	ans+=a[i];
        }

    	cout<<ans<<endl;

    }

    return 0;
}


/*
                -- ANURAG YADAV --
*/
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <vector>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
using namespace std;
using namespace __gnu_pbds;

#define deb(x) cout << #x << " " << x << endl;
#define ll long long int
#define pb push_back
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define ss second
#define ff first
#define sortall(x) sort(all(x))
#define mset(a , b) memset(a , b , sizeof(a))
#define fbo(i)  find_by_order(i)
#define ofk(i)  order_of_key(i)
#define M 1000000007

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pset;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

int small=INT_MIN;
int large=INT_MAX;

//template <typename T>

int main() {
    fast_cin();

   #ifndef ONLINE_JUDGE
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/input.txt","r",stdin);
        // freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/error.txt", "w", stderr);
           freopen("C:/Users/ANURAG/Desktop/coding/INPUT-OUTPUT/output.txt", "w", stdout);
   #endif

    ll t;
    //t = 1;
    cin >> t;
    while(t--) {
    	ll n, v[200100], k;
		cin >> n >> k;
		ll sum = 0;
		for (int i = 1; i <= n * k; i++)
			cin >> v[i];
		for (int i = (n - 1) / 2 * k + 1; i <= n * k; i += n / 2 + 1)
			sum += v[i];
		cout << sum <<endl;

    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

//EXTRA DEFINES !!!!
#define int long long

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t; cin >> t;
    while (t--) {
        int n, k; cin >> n >> k;
        vector<int> a(n*k);
        for (int i = 0; i < n * k; i++) {
            cin >> a[i];
        }
        int sm = 0;
        int l = 0, r = n * k - 1;
        while (l < r) {
            r -= n / 2;
            sm += a[r];
            r--;
            l += n / 2;
        }
        cout << sm << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

//#define int long long

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t; cin >> t;
    while (t--) {
        int n, k; cin >> n >> k;
        vector<int> a(n* k);
        for (int& x : a) {
            cin >> x;
        }
        int sm = 0;
        int l = 0, r = a.size() - 1;
        int x = n / 2;
        while (l < r) {
            r -= x;
            sm += a[r];
            r--;
            l += x;
        }
        cout << sm + (l == r ? a[r - x] : 0) << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

//#define int long long

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t; cin >> t;
    while (t--) {
        int n, k; cin >> n >> k;
        vector<int> a(n* k);
        for (int& x : a) {
            cin >> x;
        }
        int sm = 0;
        for (int i = a.size() - 1 - n / 2; i >= 0 && k--; i -= n / 2 + 1) {
            sm += a[i];
        }
        cout << sm << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

//EXTRA DEFINES !!!!
#define int long long

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t; cin >> t;
    while (t--) {
        int n, k; cin >> n >> k;
        vector<int> a(n*k);
        for (int i = 0; i < n * k; i++) {
            cin >> a[i];
        }
        int sm = 0;
        int l = 0, r = n * k - 1;
        while (l <= r) {
            r -= n / 2;
            if (r < 0) break;
            sm += a[r];
            r--;
            l += n / 2;
        }
        cout << sm << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

#define int long long

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t; cin >> t;
    while (t--) {
        int n, k; cin >> n >> k;
        vector<int> a(n* k);
        for (int& x : a) {
            cin >> x;
        }
        sort(a.begin(), a.end());

        int sm = 0;
        for (int i = a.size() - 1 - n / 2; i >= 0 && k--; i -= n / 2 + 1) {
            sm += a[i];
        }
        cout << sm << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

//EXTRA DEFINES !!!!
#define int long long

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t; cin >> t;
    while (t--) {
        int n, k; cin >> n >> k;
        vector<int> a(n*k);
        for (int i = 0; i < n * k; i++) {
            cin >> a[i];
        }
        int sm = 0;
        int l = 0, r = n * k - 1;
        while (l <= r) {
            r -= n / 2;
            sm += a[r];
            r--;
            l += n / 2;
        }
        cout << sm << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

//#define int long long

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    int t; cin >> t;
    while (t--) {
        int n, k; cin >> n >> k;
        vector<int> a(n* k);
        for (int& x : a) {
            cin >> x;
        }
        sort(a.begin(), a.end());

        int sm = 0;
        for (int i = a.size() - 1 - n / 2; i >= 0 && k--; i -= n / 2 + 1) {
            sm += a[i];
        }
        cout << sm << endl;
    }
}


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

void testCase()
{
	int n, k;
	cin >> n >> k;

	int x = n*k;

	int arr[x];

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

	int count = x;

	int addon = 0;

	// if(n/2.0 == n/2)
	// {
	// 	addon =
	// }

	int jump = 0;
	jump = 0;

	if(n % 2 == 0)
	{
		jump = n - n/2 + 1;
	}
	else
	{
		jump = n - n/2;
	}

	long long ans = 0;

	for(int i = 0; i < k; ++i)
	{
		count = count - jump;

		ans += arr[count];
	}

	cout << ans << endl;

	return;
}

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

	while(t--)
	{
		testCase();
	}

	return 0;
}


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

void testCase()
{
	int n, k;
	cin >> n >> k;

	int x = n*k;

	int arr[x];

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

	int count = x;

	int addon = 0;

	// if(n/2.0 == n/2)
	// {
	// 	addon =
	// }

	int jump = n/2 + 1;

// 	if(n % 2 == 0)
// 	{
// 		jump = n - n/2 + 1;
// 	}
// 	else
// 	{
// 		jump = n - n/2;
// 	}

	int ans = 0;

	for(int i = 0; i < k; ++i)
	{
		count = count - jump;

		ans += arr[count];
	}

	cout << ans << endl;

	return;
}

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

	while(t--)
	{
		testCase();
	}

	return 0;
}


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

void testCase()
{
	int n, k;
	cin >> n >> k;

	int x = n*k;

	int arr[x];

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

	int count = x;

	int addon = 0;

	// if(n/2.0 == n/2)
	// {
	// 	addon =
	// }

	int jump = 0;

	if(n % 2 == 0)
	{
		jump = n - n/2 + 1;
	}
	else
	{
		jump = n - n/2;
	}

	long long ans = 0;

	for(int i = 0; i < k; ++i)
	{
		count = count - jump;

		ans += arr[count];
	}

	cout << ans << endl;

	return;
}

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

	while(t--)
	{
		testCase();
	}

	return 0;
}


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

void testCase()
{
	int n, k;
	cin >> n >> k;

	int x = n*k;

	int arr[x];

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

	int count = x;

	int addon = 0;

	// if(n/2.0 == n/2)
	// {
	// 	addon =
	// }

	int jump = 0;

	if(n % 2 == 0)
	{
		jump = n - n/2 + 1;
	}
	else
	{
		jump = n - n/2;
	}

	int ans = 0;

	for(int i = 0; i < k; ++i)
	{
		count = count - jump;

		ans += arr[count];
	}

	cout << ans << endl;

	return;
}

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

	while(t--)
	{
		testCase();
	}

	return 0;
}


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

const int N = 2e5+ 5;
long long t, a[N];

int main()
{
    cin >> t;
    while(t--)
    {
        int n, k;
        cin >> n >> k;
        for(int i = 1; i <= n * k; ++i) cin >> a[i];
        long long res = 0;
        int tmp = k;
        if(n == 1) for(int i = 1; i <= k; ++i) res += a[i];
        else
            for(int i = n*k - (n/2); i >= 1 && tmp > 0 ; i -= (n/2 + 1), --tmp)
                res += a[i];

        cout << res << "\n";
    }
	return 0;
}


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

const int N = 2e5+ 5;
long long t, a[N];

int main()
{
    cin >> t;
    while(t--)
    {
        int n, k;
        cin >> n >> k;
        for(int i = 1; i <= n * k; ++i) cin >> a[i];
        long long res = 0;
        int tmp = k;
        if(n == 1) for(int i = 1; i <= k; ++i) res += a[i];
        else
        if(n != 2)
            for(int i = n*k - (n/2); i >= 1 && tmp > 0 ; i -= (n-1), --tmp)
                res += a[i];
        else
            for(int i = n*k - (n/2); i >= 1 && tmp > 0 ; i -= (n), --tmp)
                res += a[i];
        cout << res << "\n";
    }
	return 0;
}


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

const int N = 2e5+ 5;
long long t, a[N];

int main()
{
    cin >> t;
    while(t--)
    {
        int n, k;
        cin >> n >> k;
        for(int i = 1; i <= n* k; ++i) cin >> a[i];
        long long res = 0;
        int tmp = k;
        if(n != 2)
            for(int i = n*k - n + 2; i >= 1 && tmp > 0 ; i -= (n-1), --tmp)
                res += a[i];
        else
            for(int i = n*k - n + 1; i >= 1 && tmp > 0 ; i -= (n), --tmp)
                res += a[i];
        cout << res << "\n";
    }
	return 0;
}


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

const int N = 2e5+ 5;
long long t, a[N];

int main()
{
    cin >> t;
    while(t--)
    {
        int n, k;
        cin >> n >> k;
        for(int i = 1; i <= n * k; ++i) cin >> a[i];
        long long res = 0;
        int tmp = k;
        if(n == 1) for(int i = 1; i <= k; ++i) res += a[i];
        else
        if(n != 2)
            for(int i = n*k - n + 2; i >= 1 && tmp > 0 ; i -= (n-1), --tmp)
                res += a[i];
        else
            for(int i = n*k - n + 1; i >= 1 && tmp > 0 ; i -= (n), --tmp)
                res += a[i];
        cout << res << "\n";
    }
	return 0;
}


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

const int N = (int)1e6 + 6;
long long t, a[1005];

int main()
{
    cin >> t;
    while(t--)
    {
        int n, k;
        cin >> n >> k;
        for(int i = 1; i <= n* k; ++i) cin >> a[i];
        long long res = 0;
        int tmp = k;
        if(n != 2)
        for(int i = n*k - n + 2; i >= 1 && tmp > 0 ; i -= (n-1), --tmp)
            res += a[i];
        else
            for(int i = n*k - n + 1; i >= 1 && tmp > 0 ; i -= (n), --tmp)
            res += a[i];
        cout << res << "\n";
    }
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
const int maxn = 1005;
typedef long long ll;
ll a[maxn];

int main(){
	int t,n,m;
	cin>>t;
	while(t--){
		cin>>n>>m;
		int x=(n-1)/2;//第x个位置
		x=n-x; //%x==0;放进去
		for(int i=0;i<n*m;i++){
			cin>>a[i];
		}
		ll ans=0,len=1;
		int num=0;
		for(int i=n*m-1;i>=0;i--){
			if(len%x==0){
//				cout<<a[i]<<endl;
				ans+=a[i];
				num++;
				if(num==m){
					break;
				}
			}
			len++;
		}
		cout<<ans<<endl;
	}
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
const int maxn = 1005;
ll a[maxn];
typedef long long ll;
int main(){
	int t,n,m;
	cin>>t;
	while(t--){
		cin>>n>>m;
		int x=(n-1)/2;//第x个位置
		x=n-x; //%x==0;放进去
		for(int i=0;i<n*m;i++){
			cin>>a[i];
		}
		ll ans=0,len=1;
		int num=0;
		for(int i=n*m-1;i>=0;i--){
			if(len%x==0){
//				cout<<a[i]<<endl;
				ans+=a[i];
				num++;
				if(num==m){
					break;
				}
			}
			len++;
		}
		cout<<ans<<endl;
	}
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
const int maxn = 2e5+5;
typedef long long ll;
ll a[maxn];

int main(){
	int t,n,m;
	cin>>t;
	while(t--){
		cin>>n>>m;
		int x=(n-1)/2;//第x个位置
		x=n-x; //%x==0;放进去
		for(int i=0;i<n*m;i++){
			cin>>a[i];
		}
		ll ans=0,len=1;
		int num=0;
		for(int i=n*m-1;i>=0;i--){
			if(len%x==0){
				ans+=a[i];
				num++;
				if(num==m){
					break;
				}
			}
			len++;
		}
		cout<<ans<<endl;
	}
	return 0;
}


#include <iostream>
#include <string>
using namespace std;
const int maxn = 1005;
int a[maxn];
int main(){
	int t,n,m;
	cin>>t;
	while(t--){
		cin>>n>>m;
		int x=(n-1)/2;//第x个位置
		x=n-x; //%x==0;放进去
		for(int i=0;i<n*m;i++){
			cin>>a[i];
		}
		int ans=0,len=1;
		int num=0;
		for(int i=n*m-1;i>=0;i--){
			if(len%x==0){
//				cout<<a[i]<<endl;
				ans+=a[i];
				num++;
				if(num==m){
					break;
				}
			}
			len++;
		}
		cout<<ans<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>

#define MX 1e4+5

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

void solve() {
	//
	int n, k;
	cin >> n >> k;

	int ll = n * k;
	vi a(ll);
	for(int i = 0; i < ll; i++)
		cin >> a[i];

	if(n <= 2) {
		long long sum = 0;
		for(int i = 0; i < ll; i += n)
			sum += a[i];
		cout << sum << "\n";
		return;
	}

	int ss = int(n / 2) + n % 2 - 1;
	int bb = n - ss;

	//cout << "sb: " << ss << " - " << bb << "\n";

	long long sum = 0;
	for(int i = ss * k; i < ll; i += bb) {
		//cout << "x: " << a[i] << "\n";
		sum += a[i];
	}

	cout << sum << "\n";
}

int main() {

	int T;
	cin >> T;
	while(T--)
		solve();

	return 0;
}


#include <bits/stdc++.h>

#define MX 1e4+5

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

void solve() {
	//
	int n, k;
	cin >> n >> k;

	int ll = n * k;
	vi a(ll);
	for(int i = 0; i < ll; i++)
		cin >> a[i];

	int step = 0;
	if(n <= 2)
		step = n;
	else {
		int x = n / 2;
		step = n + (1-n%2) - x;
	}

	//cout << "STEP: " << step << "\n";

	int sum = 0;
	for(int i = 1; i <= k; i++) {
		//cout << "II: " << i * step << " - " << ll - i * step << " - " << a[ll - i * step] << "\n";
		sum += a[ll - i * step];
	}
	cout << sum << "\n";
}

int main() {

	int T;
	cin >> T;
	while(T--)
		solve();

	return 0;
}


#include <bits/stdc++.h>

#define MX 1e4+5

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;

void solve() {
	//
	int n, k;
	cin >> n >> k;

	int ll = n * k;
	vi a(ll);
	for(int i = 0; i < ll; i++)
		cin >> a[i];

	if(n <= 2) {
		int sum = 0;
		for(int i = 0; i < ll; i += n)
			sum += a[i];
		cout << sum << "\n";
		return;
	}

	int ss = int(n / 2) + n % 2 - 1;
	int bb = n - ss;

	//cout << "sb: " << ss << " - " << bb << "\n";

	int sum = 0;
	for(int i = ss * k; i < ll; i += bb) {
		//cout << "x: " << a[i] << "\n";
		sum += a[i];
	}

	cout << sum << "\n";
}

int main() {

	int T;
	cin >> T;
	while(T--)
		solve();

	return 0;
}


#include <bits/stdc++.h>

#define MX 1e4+5

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<vi> vvi;

void solve2(int i, int j, int isign, int jsign, vector<vii> &result) {
	vii ll;
	ll.push_back({i, j});
	ll.push_back({i+isign, j});
	ll.push_back({i+isign, j+jsign});
	result.push_back(ll);
	ll.clear();
	ll.push_back({i+isign, j+jsign});
	ll.push_back({i, j+jsign});
	ll.push_back({i, j});
	result.push_back(ll);
	ll.clear();
	ll.push_back({i+isign, j});
	ll.push_back({i, j});
	ll.push_back({i, j+jsign});
	result.push_back(ll);
	ll.clear();
}

void solve() {
	//
	int n, m;
	cin >> n >> m;

	vector<vi> a;
	for(int i = 0; i < n; i++) {
		string s;
		cin >> s;

		vi ll;
		for(char ch: s)
			ll.push_back(int(ch-'0'));
		a.push_back(ll);
	}

	vector<vii> result;
	// remove all possible 3-ones in each 2x2 square
	for(int i = 0; i < n-1; i++)
	for(int j = 0; j < m-1; j++) {
		int count1 = a[i][j] + a[i][j+1] + a[i+1][j] + a[i+1][j+1];
		if(count1 == 3) {
			vii ll;
			for(int ii = 0; ii <= 1; ii++)
			for(int jj = 0; jj <= 1; jj++)
				if(a[i+ii][j+jj])
					ll.push_back({i+ii, j+jj});
			result.push_back(ll);
			a[i][j] = a[i][j+1] = a[i+1][j] = a[i+1][j+1] = 0;
		} else if(count1 == 4) {
			vii ll;
			ll.push_back({i, j});
			ll.push_back({i, j+1});
			ll.push_back({i+1, j});
			result.push_back(ll);
			a[i][j] = a[i][j+1] = a[i+1][j] = 0;
		}
	}

	// solve for 1 or 2 ones in 2x2 square
	for(int i = 0; i < n-1; i++)
	for(int j = 0; j < m-1; j++) {
		int count1 = a[i][j] + a[i][j+1] + a[i+1][j] + a[i+1][j+1];
		if(count1 == 1) {
			if(a[i][j])
				solve2(i, j, 1, 1, result);
			else if(a[i+1][j])
				solve2(i, j+1, 1, -1, result);
			else if(a[i+1][j])
				solve2(i+1, j, -1, 1, result);
			else if(a[i+1][j+1])
				solve2(i+1, j+1, -1, -1, result);
		} else if(count1 == 2) {
			vii l0, l1;
			for(int ii = 0; ii <= 1; ii++)
			for(int jj = 0; jj <= 1; jj++)
				if(a[i+ii][j+jj])
					l1.push_back({i+ii, j+jj});
				else
					l0.push_back({i+ii, j+jj});
			l1.push_back(l0[0]);
			result.push_back(l1);
			int isign = 1, jsign = 1;
			if(min(l1[0].first, l1[1].first) == i)	isign = -1;
			if(min(l1[0].second, l1[1].second) == j)	jsign = -1;
			solve2(l0[0].first, l0[0].second, isign, jsign, result);
		}
	}

	cout << result.size() << "\n";
	for(vii lres: result) {
		for(pii x: lres)
			cout << x.first+1 << " " << x.second+1 << " ";
		cout << "\n";
	}

}

int main() {
	//
	ios_base::sync_with_stdio(false);
	int T;
	cin >> T;
	while(T--)
		solve();

	return 0;
}


#include <cstdio>
using namespace std;
long long a[1000005];

int main() {
	int t;
	int n, k;
	scanf("%d", &t);
	for (int i = 1; i <= t; i++) {
		scanf("%d%d", &n, &k);
		for (int j = 1; j <= n * k; j++) {
			scanf("%d", a[j]);
		}
		int median;
		if (n % 2 == 0) {
			median = n / 2;

		} else {
			median = n / 2 + 1;
		}
		long long lon, lon2;
		lon = (n - median + 1) * k;
		lon2 = n * k - lon + 1;
		long long  s, sum;
		sum = 0;
		s = 0;
		for (int j = k * n; j >= lon2; j--) {
			s++;
			if (s == lon) {
				sum += a[j];
				s = 0;
			}
		}
		printf("%d\n", sum);
	}
	return 0;
}


#include<iostream>
using namespace std;
int t,n,k;
int a[10000];
int long long sum=0;
int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		int u=n*k;
		sum=0;
		int y=n-((n/2)-(!(n%2)));
		int st=n*k-k*y+1;
		int x;
		for(int i=1;i<=u;i++){
			scanf("%d",&x);
			if(i>=st&&!((i-st)%(y)))sum+=x;
		}
		printf("%d\n",sum);
	}
	return 0;
}


#include <cstdio>
#include <cstring>
using namespace std;
long long a[1000005];

int main() {
	int t;
	int n, k;
	scanf("%d", &t);
	for (int i = 1; i <= t; i++) {
		memset(a, 0, sizeof(a));
		scanf("%d%d", &n, &k);
		for (int j = 1; j <= n * k; j++) {
			scanf("%lld", &a[j]);
		}
		int median;
		if (n % 2 == 0) {
			median = n / 2;
		} else {
			median = n / 2 + 1;
		}
		long long lon, lon2;
		lon = (n - median + 1);
		lon2 = n * k - lon * k + 1;
		long long  s, sum;
		sum = 0;
		s = 0;
		for (int j = k * n; j >= lon2; j--) {
			s++;
			if (s == lon ) {
				sum += a[j];
				s = 0;
			}
		}
		printf("%lld\n", sum);
	}
	return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int t,n,k;
int long long sum=0;
int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		int u=n*k;
		sum=0;
		int y=n-((n/2)-(!(n%2)));
		int st=n*k-k*y+1;
		int x;
		for(int i=1;i<=u;i++){
			scanf("%d",&x);
			if(i>=st&&!((i-st)%(y)))sum+=x;
		}
		printf("%lld\n",sum);
	}
	return 0;
}


#include<cstdio>
using namespace std;

long long a[10000005];

int main(){
	long long t,n,k,mid,s,g,d;
	scanf("%lld\n",&t);
	for(int i=0;i<t;i++){
		scanf("%lld%lld\n",&n,&k);
		for(int j=1;j<=k*n;j++){
			scanf("%lld",&a[j]);
		}
		mid=n/2;
		s=0;d=0;
		g=n*k-mid;
		while(d<k){
			s=s+a[g];
			g=g-mid-1;
			d++;
		}
	printf("%lld\n",s);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
int a[1000005];
using namespace std;
int main(){
	int t,n,k,i,j,cas,sum,num;
	scanf("%d",&t);
	for(cas=0;cas<t;cas++){
		scanf("%d%d",&n,&k);
		memset(a,0,sizeof(a));
		sum = 0;
		for(i=0;i<n*k;i++){
			scanf("%d",&a[i]);
		}
		if(n<=2){
			i = 0;
			while(i<n*k){
				sum += a[i];
				i = i + n;
			}
		}
		else{
			i = n*k - ((n / 2) + 1);
			num = 0;
			while(num<k){
				sum += a[i];
				i = i - (n / 2 + 1);
				num++;
			}
		}
		printf("%d\n",sum);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
int a[1000005];
using namespace std;
int main(){
	int t,n,k,i,j,cas,num;
	long long int sum;
	scanf("%d",&t);
	for(cas=0;cas<t;cas++){
		scanf("%d%d",&n,&k);
		memset(a,0,sizeof(a));
		sum = 0;
		for(i=0;i<n*k;i++){
			scanf("%d",&a[i]);
		}
		if(n<=2){
			i = 0;
			while(i<n*k){
				sum += a[i];
				i = i + n;
			}
		}
		else{
			i = n * k - ((n / 2) + 1);
			num = 0;
			while(num<k){
				sum += a[i];
				i = i - (n / 2 + 1);
				num++;
			}
		}
		printf("%I64d\n",sum);
	}
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;

int n  , m , k ,t;
int c0 , c1 , h;
long long a[1005] ,ans;
int main(){
    scanf("%d" ,&t);
    while(t -- ){
        ans = 0;
        scanf("%d%d" ,&n ,&k);
        for(int i = 1;i <= n*k; ++ i)scanf("%lld" , a + i);

        if( n <= 2){
            int s = 1;
            while( s <= n*k){
                ans += a[s];
                s += (n);
            }
        }
        else{
            int mid ;
            if( n % 2)mid = n /2 + 1;
            else mid = n / 2;
            int s = k + 1;
            while(s <= n *k ){
                ans += a[s];
                s += (n - 1);
            }
        }

        printf("%lld\n" ,ans);
    }
    return 0;
}
// 34 62 69


#include <cstdio>
#include <algorithm>

using namespace std;
int n  , m , k ,t;
long long a[1000005] ,ans;
int main(){
    scanf("%d" ,&t);
    while(t -- ){
        ans = 0;
        scanf("%d%d" ,&n ,&k);
        for(int i = 1;i <= n*k; ++ i)scanf("%I64d" , a + i);
        if( n <= 2){
            int s = 1;
            while( s <= n*k){
                ans += a[s];
                s += (n);
            }
        }
        else{
            int mid ;
            if( n % 2)mid = n /2 + 1;
            else mid = n / 2;
            int s = k *(mid - 1) + 1;
            while(s <= n *k ){
                ans += a[s];
                s += (n - mid + 1);
            }
        }
        printf("%I64u\n" ,ans);
    }
    return 0;
}
// 6 6 2 1 2 3 4 5 6 7 8 9 10 11 12
// 4 3 1 2 3 4 5 6 7 8 9 10 11 12


#include <cstdio>
#include <cstring>
using namespace std;
int a[1000005];

int main() {
	int t;
	scanf("%d", &t);
	while (t--) {
		memset(a, 0, sizeof(a));
		int n, k;
		scanf("%d%d", &n, &k);
		for (int i = n * k; i > 0; i--) {
			scanf("%d", &a[i]);
		}
		long long sum = 0;
		int q = n / 2 + 1;
		int x = k;
		for (int i = 1; i <= n * k; i++) {
			if (i % q == 0) {
				x--;
				sum += a[i];
			}
			if (x == 0)
				break;
		}
		printf("%d\n", sum);
	}
	return 0;
}


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

typedef long long ll;

const int N=1e6+5;

int n,m,a[N];

int main(){
	freopen("data.txt","r",stdin);
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d%d",&n,&m);
		for(int i=1;i<=n*m;i++)
			scanf("%d",&a[i]);
		ll ans=0;
		int k=n-(n+1)/2;
		for(int i=0;i<m;i++){
			ans+=a[n*m-k-i*(k+1)];
		}
		printf("%lld\n",ans);
	}
	return 0;
}


#include<iostream>
using namespace std;
int a[200005];
int main(){
    int T;
    cin >> T;
    while(T--) {
        int n, k;
        cin >> n >> k;
        for(int i=0;i<n*k;i++) cin >> a[i];
        int x = n/2 + 1;
        long long sum = 0;
        for(int i=n*k-x;i>=(n-x)*k;i-=x) {
            sum += a[i];
        }
        cout << sum << endl;
    }
}


#include <bits/stdc++.h>
#define ll long long
#define debug(x) cerr<<#x<<"="<<x<<endl
using namespace std;
int a[1000010];
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n,k;
		scanf("%d%d",&n,&k);
		int tot=n*k;
		for(int i=1;i<=tot;i++)
		{
			scanf("%d",&a[i]);
		}
		int dw;
		if (n&1) dw=(n+1)/2;
		else dw=n/2;

		int l=1,r=tot;
		long long ans=0;
		if (n&1)
		{
			while(r>=l)
		{
			r=r-dw;
			ans+=a[r+1];
		//	printf("!%d\n",a[r+1]);
			l=l+dw-1;
		//	printf("%d %d!\n",l,r);
		}
		}
		else
		{
			while(r>=l)
		{
			r=r-dw-1;
			ans+=a[r+1];
		//	printf("!%d\n",a[r+1]);
			l=l+dw-1;
		}
		}
		printf("%lld\n",ans);

	}

    return 0;
}


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

typedef long long ll;

const int N=1e6+5;

int n,m,a[N];

int main(){
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%d%d",&n,&m);
		for(int i=1;i<=n*m;i++)
			scanf("%d",&a[i]);
		ll ans=0;
		int k=n-(n+1)/2;
		for(int i=0;i<m;i++){
			ans+=a[n*m-k-i*(k+1)];
		}
		printf("%lld\n",ans);
	}
	return 0;
}


#include <cstdio>
using namespace std;

int a[1000005];

int main(){

	int t;
	scanf("%d\n",&t);

	int n=0,k=0;
	for(int i=1;i<=t;i++){

		scanf("%d %d",&n,&k);

		for(int j=1;j<=n*k;j++){
			scanf("%d",&a[j]);
		}

		int sum=0;
		int count=1;

		for(int m=(n*k-(n/2));;m-=(n/2+1)){
			sum+=a[m];

			if(count==k){
				break;
			}

			count++;
		}
		printf("%d\n",sum);
	}

	return 0;
}


#include<cstdio>
#include<cstring>
int a[1000005];
using namespace std;
int main(){
	int t,n,k,i,j,cas,num;
	long sum;
	scanf("%d",&t);
	for(cas=0;cas<t;cas++){
		scanf("%d%d",&n,&k);
		memset(a,0,sizeof(a));
		sum = 0;
		for(i=0;i<n*k;i++){
			scanf("%d",&a[i]);
		}
		if(n<=2){
			i = 0;
			while(i<n*k){
				sum += a[i];
				i = i + n;
			}
		}
		else{
			i = n * k - ((n / 2) + 1);
			num = 0;
			while(num<k){
				sum += a[i];
				i = i - (n / 2 + 1);
				num++;
			}
		}
		printf("%ld\n",sum);
	}
	return 0;
}


#include <cstdio>
#include <cstring>
using namespace std;
int a[1000005];

int main() {
	int t;
	int n, k;
	scanf("%d", &t);
	for (int i = 1; i <= t; i++) {
		memset(a, 0, sizeof(a));
		scanf("%d%d", &n, &k);
		for (int j = 1; j <= n * k; j++) {
			scanf("%d", &a[j]);
		}
		int median;
		if (n % 2 == 0) {
			median = n / 2;
		} else {
			median = n / 2 + 1;
		}
		int lon, lon2;
		lon = (n - median + 1);
		lon2 = n * k - lon * k + 1;
		int  s, sum;
		sum = 0;
		s = 0;
		for (int j = k * n; j >= lon2; j--) {
			s++;
			if (s == lon ) {
				sum += a[j];
				s = 0;
			}
		}
		printf("%d\n", sum);
	}
	return 0;
}


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

int a[10000005];

int main(){
	int t,n,k,mid,ans;

	scanf("%d",&t);

	for(int i=0;i<t;i++){
		ans=0;
		mid=0;
		scanf("%d%d",&n,&k);

		for(int i=1;i<=n*k;i++){
			scanf("%d",&a[i]);
		}
		if(n%2==0){
			mid=n/2;
		}else{
			mid=n/2+1;
		}
		mid=mid-1;

		sort(a+1,a+n*k+1);

		for(int i=k*mid+1;i<=n*k;i=i+n-mid){
			ans=ans+a[i];
		}

		printf("%d\n",ans);
	}
	return 0;
}


#include<cstdio>
using namespace std;

int a[100000005];

int main(){

	int t;
	scanf("%d\n",&t);

	int n=0,k=0;
	for(int i=1;i<=t;i++){

		scanf("%d%d",&n,&k);//n是每组个数 k是组数

		for(int j=1;j<=n*k;j++){
			scanf("%d",&a[j]);	//输入每个元素
		}

		//初始化
		int sum;
		sum=0;
		int count;
		count=1;

		for(int m=n*k-(n/2);m>0;m-=(n/2)+1){
			sum+=a[m];
			if(count==k){//取到k个数停下来
				break;
			}
			count++;
		}
		printf("%d\n",sum);
	}

	return 0;
}


#include<cstdio>
using namespace std;
int a[200005];

int main(){
	int t;
	scanf("%d",&t);
	while(t>0){
		t--;
		int n,m,s,q;
		scanf("%d%d",&n,&m);
		q=n*m;
		for(int i=1;i<=q;i++){
			scanf("%d",&a[i]);
		}
		int k;
		k=n/2+1;
		s=0;
		for(int i=q-k+1;m;i-=k){
			s+=a[i];
			m--;
		}
		printf("%d\n",s);
	}
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;
int n  , m , k ,t;
long long a[1000005] ,ans;
int main(){
    scanf("%d" ,&t);
    while(t -- ){
        ans = 0;
        scanf("%d%d" ,&n ,&k);
        for(int i = 1;i <= n*k; ++ i)scanf("%lld" , a + i);
        if( n <= 2){
            int s = 1;
            while( s <= n*k){
                ans += a[s];
                s += (n);
            }
        }
        else{
            int mid ;
            if( n % 2)mid = n /2 + 1;
            else mid = n / 2;
            int s = k *(mid - 1) + 1;
            while(s <= n *k ){
                ans += a[s];
                s += (n - mid + 1);
            }
        }
        printf("%lld\n" ,ans);
    }
    return 0;
}
// 6 6 2 1 2 3 4 5 6 7 8 9 10 11 12
// 4 3 1 2 3 4 5 6 7 8 9 10 11 12


#include<iostream>
using namespace std;
int t,n,k;
int a[10000];
int sum=0;
int main(){
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		int u=n*k;
		sum=0;
		int y=n-((n/2)-(!(n%2)));
		int st=n*k-k*y+1;
		int x;
		for(int i=1;i<=u;i++){
			scanf("%d",&x);
			if(i>=st&&!((i-st)%(y)))sum+=x;
		}
		printf("%d\n",sum);
	}
	return 0;
}


#include<cstdio>
using namespace std;

long long a[10000005];

int main(){
	long long t,n,k,mid,s,g,d;
	scanf("%lld\n",&t);
	for(int i=0;i<t;i++){
		scanf("%lld%lld\n",&n,&k);
		for(int j=1;j<=k*n;j++){
			scanf("%lld",&a[j]);
		}
		mid=n/2;
		s=0;d=0;
		g=n*k-mid;
		while(d<k){
			s=s+a[g];
			g=g-mid-1;
			d++;
		}
	printf("%lld\n",s);
	}
	return 0;
}


#include <cstdio>
#include <algorithm>

using namespace std;
int n  , m , k ,t;
int c0 , c1 , h;
long long a[1005] ,ans;
int main(){
    scanf("%d" ,&t);
    while(t -- ){
        ans = 0;
        scanf("%d%d" ,&n ,&k);
        for(int i = 1;i <= n*k; ++ i)scanf("%lld" , a + i);
        if( n <= 2){
            int s = 1;
            while( s <= n*k){
                ans += a[s];
                s += (n);
            }
        }
        else{
            int mid ;
            if( n % 2)mid = n /2 + 1;
            else mid = n / 2;
            int s = k *(mid - 1) + 1;
            while(s <= n *k ){
                ans += a[s];
                s += (n - mid + 1);
            }
        }
        printf("%lld\n" ,ans);
    }
    return 0;
}
// 6 6 2 1 2 3 4 5 6 7 8 9 10 11 12


#include<cstdio>
using namespace std;

long long a[10000005];

int main(){
	long long t,n,k,mid,ans;

	scanf("%lld",&t);

	for(int i=0;i<t;i++){
		ans=0;
		mid=0;
		scanf("%lld%lld",&n,&k);

		for(int i=1;i<=n*k;i++){
			scanf("%lld",&a[i]);
		}
		if(n%2==0){
			mid=n/2;
		}else{
			mid=n/2+1;
		}
		mid=mid-1;

		for(int i=k*mid+1;i<=n*k;i=i+n-mid){
			ans=ans+a[i];
		}

		printf("%lld\n",ans);
	}
	return 0;
}


#include <cstdio>
#include <cstring>
using namespace std;
long long a[1000005];

int main() {
	int t;
	int n, k;
	scanf("%d", &t);
	for (int i = 1; i <= t; i++) {
		memset(a, 0, sizeof(a));
		scanf("%d%d", &n, &k);
		for (int j = 1; j <= n * k; j++) {
			scanf("%lld", &a[j]);
		}
		int median;
		if (n % 2 == 0) {
			median = n / 2;
		} else {
			median = n / 2 + 1;
		}
		long long lon, lon2;
		lon = (n - median + 1);
		lon2 = n * k - lon * k + 1;
		long long  s, sum;
		sum = 0;
		s = 0;
		for (int j = k * n; j >= lon2; j--) {
			s++;
			if (s == lon ) {
				sum += a[j];
				s = 0;
			}
		}
		printf("%lld\n", sum);
	}
	return 0;
}


#include<cstdio>
using namespace std;

long long a[1000005],b[105];
int main(){
    int n,i,j,m,x,y;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d%d",&x,&y);
        for(j=0;j<x*y;j++){
            scanf("%lld",&a[j]);
        }
        m=x*y;
        for(j=0;j<y;j++){
            m-=x/2+1;
            b[i]+=a[m];
        }
    }
    for(i=0;i<n;i++){
        printf("%lld\n",b[i]);
    }

    return 0;
}


#include<iostream>
using namespace std;
int t,n,k;
int a[10000];
int long long sum=0;
int main(){
	cin>>t;
	while(t--){
		cin>>n>>k;
		int u=n*k;
		sum=0;
		if(n==2){
			for(int i=1;i<=n*k;i++)scanf("%d",&a[i]);
			for(int i=1;i<=n*k;i+=2)sum+=a[i];
			printf("%d\n",sum);
			continue;
		}
		if(n==1){
			for(int i=1;i<=n;i++){
				int x;
				cin>>x;
				sum+=x;
				printf("%d\n",sum);
				continue;
			}
		}
		for(int i=1;i<=u;i++)scanf("%d",&a[i]);
		int y=n-((n/2)-(!(n%2)));
		for(int i=u-y+1;i>=n*k-k*y;i-=y){
			sum+=a[i];
		}
		printf("%d\n",sum);
	}
	return 0;
}


#include<cstdio>
using namespace std;

long long a[1000005];

int main(){
	long long t,n,k,mid,ans;
	scanf("%lld",&t);
	for(int i=0;i<t;i++){
		ans=0;
		scanf("%lld%lld",&n,&k);
		for(int i=0;i<n*k;i++){
			scanf("%lld",&a[i]);
		}

		if(n%2==0){
			mid=n/2;
		}else{
			mid=n/2+1;
		}
		mid=mid-1;
		for(int i=mid*k;i<n*k;i=i+n-mid){
			ans=ans+a[i];
		}
		printf("%I64d\n",ans);
	}
	return 0;
}


#include<cstdio>
using namespace std;

int a[10000005];
int x[10005];

int main(){
	int t,n,k,mid,s,g,d;
	scanf("%d\n",&t);
	for(int i=0;i<t;i++){
		scanf("%d%d\n",&n,&k);
		for(int j=1;j<=k*n;j++){
			scanf("%d",&a[j]);
		}
		mid=n/2;
		s=0;d=0;
		g=n*k-mid;
		while(d<k){
			s=s+a[g];
			g=g-mid-1;
			d++;
		}
	x[i]=s;
	}
	for(int i=0;i<t;i++){
		printf("%d\n",x[i]);
	}
	return 0;
}


#include<cstdio>
using namespace std;

int a[10000005];

int main(){
	int t,n,k,mid,s,g,d;
	scanf("%d\n",&t);
	for(int i=0;i<t;i++){
		scanf("%d%d\n",&n,&k);
		for(int j=1;j<=k*n;j++){
			scanf("%d",&a[j]);
		}
		mid=n/2;
		s=0;d=0;
		g=n*k-mid;
		while(d<k){
			s=s+a[g];
			g=g-mid-1;
			d++;
		}
	printf("%d\n",s);
	}
	return 0;
}


#include<iostream>
using namespace std;
int t,n,k;
int a[10000];
int long long sum=0;
int main(){
	cin>>t;
	while(t--){
		cin>>n>>k;
		int u=n*k;
		sum=0;
		if(n==2){
			for(int i=1;i<=n*k;i++)cin>>a[i];
			for(int i=1;i<=n*k;i+=2)sum+=a[i];
			cout<<sum<<endl;
			continue;
		}
		if(n==1){
			for(int i=1;i<=n;i++){
				int x;
				cin>>x;
				sum+=x;
				cout<<sum<<endl;
				continue;
			}
		}
		for(int i=1;i<=u;i++)cin>>a[i];
		int y=n-((n/2)-(!(n%2)));
		for(int i=u-y+1;i>=n*k-k*y;i-=y){
			sum+=a[i];
		}
		cout<<sum<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define debug(x) cerr<<#x<<"="<<x<<endl
using namespace std;
int a[1000010];
int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		int n,k;
		scanf("%d%d",&n,&k);
		int tot=n*k;
		for(int i=1;i<=tot;i++)
		{
			scanf("%d",&a[i]);
		}
		int dw;
		if (n&1) dw=(n+1)/2;
		else dw=n/2;

		int l=1,r=tot;
		long long ans=0;
		if (n&1)
		{
			while(r>=l)
		{
			r=r-dw;
			ans+=a[r+1];
		//	printf("!%d\n",a[r+1]);
			l=l+dw-1;
		//	printf("%d %d!\n",l,r);
		}
		}
		else
		{
			while(r>=l)
		{
			r=r-dw-1;
			ans+=a[r+1];
		//	printf("!%d\n",a[r+1]);
			l=l+dw-1;
		}
		}
		printf("%lld\n",ans);

	}

    return 0;
}


#include<cstdio>
using namespace std;

long long a[100000005];

int main(){
	long long t,n,k,x,y,mid,sum;
	scanf("%lld",&t);
	for(int i=0;i<t;i++){
		scanf("%lld%lld",&n,&k);
		for(int j=0;j<n*k;j++){
			scanf("%lld",&a[j]);
		}
		mid=n/2+1;
		sum=0;x=0;
		y=k*n-mid;
		while(x<k){
		sum=sum+a[y];
		y=y-mid;
		x++;
		}
		printf("%lld\n",sum);
	}

	return 0;
}


#include<cstdio>
using namespace std;

int a[10000005];

int main(){
	int t,n,k,mid,ans;

	scanf("%d",&t);

	for(int i=0;i<t;i++){
		ans=0;
		mid=0;
		scanf("%d%d",&n,&k);

		for(int i=1;i<=n*k;i++){
			scanf("%d",&a[i]);
		}
		if(n%2==0){
			mid=n/2;
		}else{
			mid=n/2+1;
		}
		mid=mid-1;
		for(int i=k*mid+1;i<=n*k;i=i+n-mid){
			ans=ans+a[i];
		}

		printf("%d\n",ans);
	}
	return 0;
}


#include<cstdio>
using namespace std;
int a[1000005];
int main(){
	int t,n,m,s,q;
	scanf("%d",&t);
	while(t>0){
		t--;
		scanf("%d%d",&n,&m);
	    q=n*m;
    	for(int i=1;i<=q;i++){
		    scanf("%d",&a[i]);
	    }
	    int k;
	    k=n/2+1;
	    s=0;
	    for(int j=q-k+1;m;j-=k){
		    s+=a[j];
		    m--;
	    }
	    printf("%d\n",s);
	}
	return 0;
}


#include<iostream>
using namespace std;
int t,n,k;
int a[10000];
int long long sum=0;
int main(){
	cin>>t;
	while(t--){
		cin>>k>>n;
		sum=0;
		for(int i=1;i<=n;i++){
			for(int j=1;j<=k;j++){
				int x;
				cin>>x;
				if(j==k/2)sum+=x;
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}


#include<cstdio>
using namespace std;

int a[105],b[105];

int main(){
	int z,n,m,s,k,j,t,q,ans;

	scanf("%d",&z);
	while(z>0){
		scanf("%d%d",&n,&m);
		s = n*m;
		for(int i=1;i<=n;i++){
			scanf("%d",&a[i]);
		}
		k = 1;;j = 1;
		for(int i=1;i<=n;i++){
			b[i] = a[k];
			k += n;
			if(k>n){
				j++;
				k = j;
			}
		}
		q = (n+1)/2;
		for(int i=1;i<=n;i++){
			ans += b[q];
			q += n;
		}
		printf("%d",ans);
		z--;
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
void solve(){
int a, b;
cin >> a >> b;
int sum = 0;
vector<int> arr(a*b);
for(int i = 0; i < a*b; i++){
    cin >> arr[i];
}
int pos = -1;
int ju = a-ceil((a/2.0)) +1;
sort(arr.rbegin(), arr.rend());
for(int i = 0; i < b; i++){
 pos += ju;
sum += arr[pos ];
}
cout << sum << "\n";
}
int main(){
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int a, b;
cin >> a >> b;
int sum = 0;
vector<int> arr(a*b);
for(int i = 0; i < a*b; i++){
    cin >> arr[i];
}
int pos = -1;
int ju = a-ceil((a/2.0)) +1;
sort(arr.rbegin(), arr.rend());
for(int i = 0; i < b; i++){
 pos += ju;
sum += arr[pos ];
}
cout << sum << "\n";
}
signed main(){
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}


#include<bits/stdc++.h>
using namespace std;
void solve(){
int a, b;
cin >> a >> b;
int sum = 0;
vector<int> arr(a*b);
for(int i = 0; i < a*b; i++){
    cin >> arr[i];
}
int pos = -1;
int ju = a-(a/2) +1;
sort(arr.rbegin(), arr.rend());
for(int i = 0; i < b; i++){
 pos += ju;
sum += arr[pos ];
}
cout << sum << "\n";
}
int main(){
    int t;
    cin >> t;
    while(t--){
        solve();
    }
}


#include  <bits/stdc++.h>
#define int long long
using namespace std;
const int N=500001;
int t,m;
int a[N];
char b[N];
int n,k,c1,h;
main(){
	scanf("%lld",&t);
	for(int i=0;i<t;i++){
		scanf("%lld%lld",&n,&k);
		int nk=n*k;
		int sum=0;
		for(int j=0;j<nk;j++)
			scanf("%lld",&a[j]);
		int f=n/2;
		if(n!=2)
		for(int j=nk-f-1,mk=1;j>=0&&mk<=k;j-=n-1,mk++){
			sum+=a[j];
		}
		else if(n==2){
			for(int j=0;j<nk;j+=2){
				sum+=a[j];
			}
		}
		else {
			for(int j=0;j<nk;j++){
				sum+=a[j];
			}
		}
		cout<<sum<<endl;
	}
}


#include  <bits/stdc++.h>
#define int long long
using namespace std;
const int N=50001;
int t,m;
int a[N];
char b[N];
int n,k,c1,h;
main(){
	scanf("%lld",&t);
	for(int i=0;i<t;i++){
		scanf("%lld%lld",&n,&k);
		int nk=n*k;
		int sum=0;
		for(int j=0;j<nk;j++)
			scanf("%lld",&a[j]);
		int f=n/2;
		if(n!=2&&n!=1)
		for(int j=nk-f-1,mk=1;j>=0&&mk<=k;j-=n-1,mk++){
			sum+=a[j];
		}
		else if(n==2){
			for(int j=0;j<nk;j+=2){
				sum+=a[j];
			}
		}
		else {
			for(int j=0;j<nk;j++){
				sum+=a[j];
			}
		}
		cout<<sum<<endl;
	}
}


#include  <bits/stdc++.h>
#define int long long
using namespace std;
const int N=500001;
int t,m;
int a[N];
char b[N];
int n,k,c1,h;
main(){
	scanf("%lld",&t);
	for(int i=0;i<t;i++){
		scanf("%lld%lld",&n,&k);
		int nk=n*k;
		int sum=0;
		for(int j=0;j<nk;j++)
			scanf("%lld",&a[j]);
		int f=n/2;
		if(n!=2&&n!=1)
		for(int j=nk-f-1,mk=1;j>=0&&mk<=k;j-=n-1,mk++){
			sum+=a[j];
		}
		else if(n==2){
			for(int j=0;j<nk;j+=2){
				sum+=a[j];
			}
		}
		else {
			for(int j=0;j<nk;j++){
				sum+=a[j];
			}
		}
		cout<<sum<<endl;
	}
}


#include<iostream>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<climits>

#define pb push_back
#define rep(i, a, n) for(int (i)=a; (i)<(n); (i)++)
#define FOR(i, n) rep(i, 0, n)
#define F(n) FOR(i, n)
#define FF(n) FOR(j, n)
#define repi(i, a, n) for(int (i)=a; (i)<=(n); (i)++)
#define FORI(i, n) repi(i, 1, n)
#define FI(n) FORI(i, n)
#define FFI(n) FORI(j, n)
#define IN(x) int x; cin>>(x);
#define SIN(x) string x; cin>>(x);
#define INN(x, y) int x, y; cin>>(x)>>(y);
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define vpii vector<pair<int, int> >
#define sortv(x) sort((x).begin(), (x).end())
#define sortvd(x) sort((x).begin(), (x).end(), greater<int>())
#define lboundv(x,v) lower_bound((x).begin(),(x).end(),(v))-(x).begin();
#define uboundv(x,v) upper_bound((x).begin(),(x).end(),(v))-(x).begin();
#define fi first
#define se second
#define mems(a, v) memset((a), (v), sizeof((a)))
#define mp make_pair
#define log(x) cout<<#x<<" : "<<x<<endl;
#define logp(x) cout<<#x<<" : ("<<x.fi<<", "<<x.se<<")"<<endl;
#define logai(a, i) cout<<#a<<'['<<i<<']'<<" : "<<a[i]<<endl;
#define loga(a, n) cout<<#a<<" -> "; F(n) cout<<i<<": "<<a[i]<<", "; cout<<endl;
#define logv(a) loga(a, a.size())
#define out(x) cout<<x<<endl
#define outp(x) cout<<x.fi<<' '<<x.se<<endl
#define outa(a, n) F(n) cout<<a[i]<<' '; cout<<endl;
#define outv(a) outa(a, a.size())
#define sim template<class t
typedef long long ll;
typedef long double LD;
sim> void maxi(t &x, t y) {if(x<y) x=y;}
sim> void mini(t &x, t y) {if(x>y) x=y;}
using namespace std;

#define N 200005

int n;
ll s[N];
ll dif[N], x[N], ps[N], mv[N];

bool sq(ll x) {
    ll v = sqrt(x);
    return v*v==x;
}

bool solve(int i) {
    /* cout<<"solve "<<i<<endl; */
    /* FFI(i) cout<<x[j]<<' '; cout<<endl; */
    if(i>n) return true;
    ll v = ps[i-1];
    /* log(v); */
    int in = lower_bound(s, s+N, v+1)-s;
    /* log(in); */
    /* log(s[in]); */
    while(in < N-1) {
        if(s[in+1]-s[in] > x[i+1]) return false;
        x[i] = s[in]-v;
        ps[i+1] = s[in]+x[i+1];
        if(sq(ps[i+1]))
        if(sq(ps[i+1]) && solve(i+2)) return true;
        in++;
    }
    return false;
}

int main() {
	ios::sync_with_stdio(0);
    FI(N-1) {
        dif[i] = 2*i-1;
        s[i] = (ll)i*i;
    }
    /* loga(s, 10); */
    /* log(lower_bound(s, s+N, 1ll)-s); */
    cin>>n;
    FI(n/2) {
        cin>>x[2*i];
    }
    FI(n/2) {
        int in = lower_bound(dif, dif+N, x[2*i])-dif;
        mv[2*i-1] = s[in+2];
    }
    if(solve(1)) {
        out("Yes");
        FI(n) cout<<x[i]<<' '; cout<<endl;
    }
    else out("No");
	return 0;
}