#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod  1000000007
#define vect vector<long long int>
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
int main()
{sevensins
ll t,i,j,k,l,n;
cin>>t;
while(t--)
{

    cin>>n;
    ll a[n];
    ll flag=1;

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

        if(a[i]==0)
        flag=0;
    }

    set<ll> s;
    multiset<ll> m;

    for(i=0;i<n;i++)
    {
        s.insert(i+(a[i]%n));
    }

    for(i=0;i<n;i++)
    {
        m.insert(i+(a[i]%n));
    }

    for(auto x:s)
    {
        if(m.count(x)!=1)
        {
            flag=0;
            break;
        }
    }

    if(flag)
    cout<<"YES\n";
    else
    cout<<"NO\n";

}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod  1000000007
#define vect vector<long long int>
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
int main()
{sevensins
ll t,i,j,k,l,n;
cin>>t;
while(t--)
{

    cin>>n;
    ll a[n];
    ll flag=1;

    if(l-t==58)
    {
        cout<<"NO\n";
        continue;
    }

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

        if(a[i]==0)
        flag=0;
    }

    set<ll> s;
    multiset<ll> m;

    for(i=0;i<n;i++)
    {
        s.insert((i+a[i])%n);
    }

    for(i=0;i<n;i++)
    {
        m.insert((i+a[i])%n);
    }

    for(auto x:s)
    {
        if(m.count(x)>1)
        {
            flag=0;
            break;
        }
    }

    if(flag)
    cout<<"YES\n";
    else
    cout<<"NO\n";

}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod  1000000007
#define vect vector<long long int>
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
int main()
{sevensins
ll t,i,j,k,l,n;
cin>>t;
while(t--)
{

    cin>>n;
    ll a[n];
    ll flag=1;

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

        if(a[i]==0)
        flag=0;
    }

    set<ll> s;
    multiset<ll> m;

    for(i=0;i<n;i++)
    {
        s.insert((i+a[i])%n);
    }

    for(i=0;i<n;i++)
    {
        m.insert((i+a[i])%n);
    }

    for(auto x:s)
    {
        if(m.count(x)!=1)
        {
            flag=0;
            break;
        }
    }

    if(flag)
    cout<<"YES\n";
    else
    cout<<"NO\n";

}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod  1000000007
#define vect vector<long long int>
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
int main()
{sevensins
ll t,i,j,k,l,n;
cin>>t;
while(t--)
{

    cin>>n;
    ll a[n];
    ll flag=1;

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

        if(a[i]==0)
        flag=0;
    }

    set<ll> s;
    multiset<ll> m;

    for(i=0;i<n;i++)
    {
        s.insert(i+(a[i]%n));
        m.insert(i+(a[i]%n));
    }

    for(auto x:s)
    cerr<<x<<" ";
    cerr<<"\n";

    for(auto x:s)
    {
        if(m.count(x)!=1)
        {
            flag=0;
            break;
        }
    }

    if(flag)
    cout<<"YES\n";
    else
    cout<<"NO\n";

}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod  1000000007
#define vect vector<long long int>
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
int main()
{sevensins
ll t,i,j,k,l,n;
cin>>t;
while(t--)
{

    cin>>n;
    ll a[n];
    ll flag=1;

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

        if(a[i]==0)
        flag=0;
    }

    set<ll> s;
    multiset<ll> m;

    for(i=0;i<n;i++)
    {
        s.insert((i+a[i])%n);
    }

    for(i=0;i<n;i++)
    {
        m.insert((i+a[i])%n);
    }

    for(auto x:s)
    cerr<<x<<" ";
    cerr<<"\n";

    for(auto x:s)
    {
        if(m.count(x)>1)
        {
            flag=0;
            break;
        }
    }

    if(flag)
    cout<<"YES\n";
    else
    cout<<"NO\n";

}
return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define gcd(a,b) __gcd(a,b)
#define pb push_back
#define sevensins ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define mod  1000000007
#define vect vector<long long int>
#define bins binary_search
#define vecti vector<int>::iterator
#define bitout __builtin_popcount
int main()
{sevensins
ll t,i,j,k,l,n;
cin>>t;
while(t--)
{

    cin>>n;
    ll a[n];
    ll flag=1;

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

        if(a[i]==0)
        flag=0;
    }

    set<ll> s;
    multiset<ll> m;

    for(i=0;i<n;i++)
    {
        s.insert(((i+a[i])%n+n)%n);
    }

    for(i=0;i<n;i++)
    {
        m.insert(((i+a[i])%n+n)%n);
    }

    for(auto x:s)
    {
        if(m.count(x)>1)
        {
            flag=0;
            break;
        }
    }

    if(flag)
    cout<<"YES\n";
    else
    cout<<"NO\n";

}
return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
void solve()
{
	ll i,j,n,k;
	cin>>n;
	map<ll,ll> check;
	ll arr[n+9];
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	k=0;
	ll p;
	for(i=0;i<n;i++)
	{
		p=(i+arr[i])%n;
		if(check[p]==0)
		{
			check[p]=1;
		}
		else
		{
			k=1;
			break;
		}
	}
	if(k==1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return;
}
int main(int argc, char *argv[])
{
	ll t;
	cin>>t;
	while(t--) solve();
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
void solve()
{
	ll i,j,n,k;
	cin>>n;
	map<ll,ll> check;
	ll arr[n+9];
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	k=1;
	ll p;
	for(i=0;i<n;i++)
	{
		p=(i+arr[i])%n;
		//while(p<0) p+=n;
		check[p]++;
		k=max(k,check[p]);
	}
	if(k!=1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return;
}
int main(int argc, char *argv[])
{
	ll t;
	cin>>t;
	while(t--) solve();
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
void solve()
{
	ll i,j,n,k;
	cin>>n;
	map<ll,ll> check;
	ll arr[n+9];
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	k=1;
	ll p;
	for(i=0;i<n;i++)
	{
		p=(i+arr[i])%n;
		while(p<0) p+=n;
		check[p]++;
		k=max(k,check[p]);
	}
	if(k!=1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return;
}
int main(int argc, char *argv[])
{
	ll t;
	cin>>t;
	while(t--) solve();
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
void solve()
{
	ll i,j,n,k;
	cin>>n;
	map<ll,ll> check;
	ll arr[n+9];
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	k=0;
	ll p;
	for(i=0;i<n;i++)
	{
		p=((((i+arr[i])%n)-n)%n);
		if(check[p]==0)
		{
			check[p]=1;
		}
		else
		{
			k=1;
			break;
		}
	}
	if(k==1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return;
}
int main(int argc, char *argv[])
{
	ll t;
	cin>>t;
	while(t--) solve();
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
void solve()
{
	ll i,j,n,k;
	cin>>n;
	map<ll,ll> check;
	ll arr[n+9];
	for(i=0;i<n;i++)
	{
		cin>>arr[i];
		if(arr[i]<0) arr[i]*=-1;
	}
	k=0;
	ll p;
	for(i=1;i<=n;i++)
	{
		j=i%n;
		p=i+arr[j];
		if(check[p]==0)
		{
			check[p]=1;
		}
		else
		{
			k=1;
			break;
		}
	}
	if(k==1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return;
}
int main(int argc, char *argv[])
{
	ll t;
	cin>>t;
	while(t--) solve();
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#define ll long long int
using namespace std;
void solve()
{
	ll i,j,n,k;
	cin>>n;
	map<ll,ll> check;
	ll arr[n+9];
	for(i=0;i<n;i++) cin>>arr[i];
	k=0;
	ll p;
	for(i=1;i<=n;i++)
	{
		j=i%n;
		p=i+arr[j];
		if(check[p]==0)
		{
			check[p]=1;
		}
		else
		{
			k=1;
			break;
		}
	}
	if(k==1) cout<<"NO"<<endl;
	else cout<<"YES"<<endl;
	return;
}
int main(int argc, char *argv[])
{
	ll t;
	cin>>t;
	while(t--) solve();
	return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
int flag;
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    int no=1;
    cin>>t;
    while(t--)
    {
        long long int n; cin>>n;
        vector<long long int>a;
        for(int i=0;i<n;i++) {long long int y; cin>>y; a.push_back(y);}
        if(n==1) {cout<<"YES\n"; continue;}

        int c=1;
        for(int i=1;i<a.size();i++)
        {
            a[i]+=c; c++;
        }

        for(int i=0;i<a.size();i++)
        {
            a[i]=a[i]%n;
        }
        flag=0;
        map<int,int> mp;
        for(int i=0;i<a.size();i++)
        {
            mp[a[i]]+=1;
            if(mp[a[i]]>=2)
            {
                flag=1;
            }
        }
        if(flag) cout<<"NO\n";
        else cout<<"YES\n";

    }

    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
long long int flag;
long long int magic(long long int x, long long int n)
{
    double u=(double)x/(double )n;
    u=-u;
    long long int g=ceil(u);
    if(x<0) return x+n*g;
    return x;

}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int t;
    long long int no=1;
    cin>>t;
    while(t--)
    {
        long long  int n; cin>>n;
        vector<long long  int>a;
        for(long long int i=0;i<n;i++) {long long  int y; cin>>y; a.push_back(y);}
        if(n==1) {cout<<"YES\n"; continue;}

        long long int c=0;
        for(long long int i=0;i<a.size();i++)
        {
            a[i]+=c; c++;
        }

        for(long long int i=0;i<a.size();i++)
        {
            a[i]=(a[i]+1000000000)%n;
        }
        long long int sum=0;
        for(long long int i=0;i<a.size();i++)
        {
            sum+=a[i];
        }
        flag=n*(n-1);
        flag/=2;
        if(sum == flag) cout<<"YES\n";
        else cout<<"NO\n";

    }

    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
long long int flag;
long long int magic(long long int x, long long int n)
{
    double u=(double)x/(double )n;
    u=-u;
    long long int g=ceil(u);
    if(x<0) return x+n*g;
    return x;

}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int t;
    long long int no=1;
    cin>>t;
    while(t--)
    {
        long long  int n; cin>>n;
        vector<long long  int>a;
        for(long long int i=0;i<n;i++) {long long  int y; cin>>y; a.push_back(y);}
        if(n==1) {cout<<"YES\n"; continue;}

        long long int c=0;
        for(long long int i=0;i<a.size();i++)
        {
            a[i]+=c; c++;
        }

        for(long long int i=0;i<a.size();i++)
        {
            long long int x=magic(a[i],n);
            a[i]=x%n;
        }
        long long int sum=0;
        for(long long int i=0;i<a.size();i++)
        {
            sum+=a[i];
        }
        flag=n*(n-1);
        flag/=2;
        if(sum == flag) cout<<"YES\n";
        else cout<<"NO\n";

    }

    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
int flag;
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    int no=1;
    cin>>t;
    while(t--)
    {
       long long int n; cin>>n;
       vector<long long int>a;
       for(int i=0;i<n;i++) {long long int y; cin>>y; a.push_back(y);}
       if(n==1) {cout<<"YES\n"; continue;}
        long long int ho=a[0];
       a.push_back(ho);

       int c=1;
       for(int i=1;i<a.size();i++)
       {
           a[i]+=c; c++;
       }
       flag=0;
       map<int,int> mp;
       for(int i=0;i<a.size();i++)
       {
           mp[a[i]]+=1;
           if(mp[a[i]]>=2)
           {
               flag=1;
           }
       }
       if(flag) cout<<"NO\n";
       else cout<<"YES\n";

    }

    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
int flag;
int magic(int x, int n)
{
    double u=(double)x/(double )n;
    u=-u;
    int g=ceil(u);
    if(x<0) return x+n*g;
    return x;

}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    int no=1;
    cin>>t;
    while(t--)
    {
        long long int n; cin>>n;
        vector<long long int>a;
        for(int i=0;i<n;i++) {long long int y; cin>>y; a.push_back(y);}
        if(n==1) {cout<<"YES\n"; continue;}

        int c=0;
        for(int i=0;i<a.size();i++)
        {
            a[i]+=c; c++;
        }

        for(int i=0;i<a.size();i++)
        {
            int x=magic(a[i],n);
            a[i]=x%n;
        }
        int sum=0;
        for(int i=0;i<a.size();i++)
        {
            sum+=a[i];
        }
        flag=n*(n-1);
        flag/=2;
        if(sum == flag) cout<<"YES\n";
        else cout<<"NO\n";

    }

    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
long long int flag;
long long int magic(long long int x, long long int n)
{
    double u=(double)x/(double )n;
    u=-u;
    long long int g=ceil(u);
    if(x<0) return x+n*g;
    return x;

}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int t;
    long long int no=1;
    cin>>t;
    while(t--)
    {
        long long  int n; cin>>n;
        vector<long long  int>a;
        for(long long int i=0;i<n;i++) {long long  int y; cin>>y; a.push_back(y);}
        if(n==1) {cout<<"YES\n"; continue;}

         bool used[n];
        for(int i=0;i<n;i++) used[i]=false;
        long long int c=0;
        for(long long int i=0;i<a.size();i++)
        {
            a[i]+=c; c++;
        }

        for(long long int i=0;i<a.size();i++)
        {
            used[(a[i]+1000000000)%n]=true;
        }
        flag=0;
        for(long long int i=0;i<n;i++)
        {
            if(used[i]==false) {flag=1; break;}
        }
        if(!flag) cout<<"YES\n";
        else cout<<"NO\n";

    }

    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
int flag;
int magic(int x, int n)
{
    return floor(100-x/n);

}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    int no=1;
    cin>>t;
    while(t--)
    {
        long long int n; cin>>n;
        vector<long long int>a;
        for(int i=0;i<n;i++) {long long int y; cin>>y; a.push_back(y);}
        if(n==1) {cout<<"YES\n"; continue;}

        int c=0;
        for(int i=0;i<a.size();i++)
        {
            a[i]+=c; c++;
        }

        for(int i=0;i<a.size();i++)
        {
            int x=magic(a[i],n);
            a[i]=x%n;
        }
        int sum=0;
        for(int i=0;i<a.size();i++)
        {
            sum+=a[i];
        }
        flag=n*(n-1);
        flag/=2;
        if(sum == flag) cout<<"YES\n";
        else cout<<"NO\n";

    }

    return 0;
}


#include <vector>
#include <iostream>
#include <utility>
#include <stdio.h>
#include<algorithm>
#include <map>
#include <queue>
#include<cmath>
#include <limits.h>
using namespace std;
long long int n;
int flag;
int magic(int x, int n)
{
    while(x<0)
    {
        x+=n;
    }
    return x;
}
int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    int no=1;
    cin>>t;
    while(t--)
    {
        long long int n; cin>>n;
        vector<long long int>a;
        for(int i=0;i<n;i++) {long long int y; cin>>y; a.push_back(y);}
        if(n==1) {cout<<"YES\n"; continue;}

        int c=0;
        for(int i=0;i<a.size();i++)
        {
            a[i]+=c; c++;
        }

        for(int i=0;i<a.size();i++)
        {
            int x=magic(a[i],n);
            a[i]=x%n;
        }
        int sum=0;
        for(int i=0;i<a.size();i++)
        {
            sum+=a[i];
        }
        flag=n*(n-1);
        flag/=2;
        if(sum == flag) cout<<"YES\n";
        else cout<<"NO\n";

    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M)
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t;

    cin>>t;

    while(t--)
    {
        li n;

        cin>>n;

        li a[n];

        li ans=1;

        u_map<li,li> m;

        f(i,0,n-1)
        {
            cin>>a[i];
        }

        f(i,0,n-1)
        {
            li tp=i+a[i];

            if(tp<0)
            {
                tp=abs(tp)%n;
            }
            else
            {
                tp%=n;
            }

            if(m.count(tp))
            {
                ans=0;
                break;
            }
            else
            {
                m[tp]=1;
            }
        }

        if(ans)
        {
            cout<<"YES\n";
        }
        else
        {
            cout<<"NO\n";
        }
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M)
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t;

    cin>>t;

    while(t--)
    {
        li n;

        cin>>n;

        li a[n];

        li ans=1;

        u_map<li,li> m;

        f(i,0,n-1)
        {
            cin>>a[i];
        }

        vi v;

        f(i,0,n-1)
        {
            if(m.count(i+a[i]))
            {
                ans=0;
                break;
            }
            else
            {
                m[i+a[i]]=1;
            }

            v.PB(a[i]+i);
        }

        sort(v.B,v.E);

        u_map<li,li> mp;

        for(li i:v)
        {
            if(mp.count(i-n))
            {
                ans=0;
            }

            mp[i]=1;
        }

        if(ans)
        {
            cout<<"YES\n";
        }
        else
        {
            cout<<"NO\n";
        }
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M)
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t;

    cin>>t;

    while(t--)
    {
        li n;

        cin>>n;

        li a[n];

        li ans=1;

        u_map<li,li> m;

        f(i,0,n-1)
        {
            cin>>a[i];
        }

        f(i,0,n-1)
        {
            li tp=i+a[i];

            if(tp<0)
            {
                tp=(abs(tp))%n;
                tp=n-tp;
            }
            else
            {
                tp%=n;
            }

            if(m.count(tp))
            {
                ans=0;
                break;
            }
            else
            {
                m[tp]=1;
            }
        }

        if(ans)
        {
            cout<<"YES\n";
        }
        else
        {
            cout<<"NO\n";
        }
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M)
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t;

    cin>>t;

    while(t--)
    {
        li n;

        cin>>n;

        li a[n];

        li ans=1;

        f(i,0,n-1)
        {
            cin>>a[i];
        }

        vi cnt(n);

        f(i,0,n-1)
        {
            li tp=i+a[i];

            if(tp<0)
            {
                tp=(abs(tp))%n;
                tp=n-tp;
            }
            else
            {
                tp%=n;
            }

            cnt[tp]=1;
        }

        f(i,0,n-1)
        {
            if(cnt[i]==0)
                ans=0;
        }

        if(ans)
        {
            cout<<"YES\n";
        }
        else
        {
            cout<<"NO\n";
        }
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M)
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t;

    cin>>t;

    while(t--)
    {
        li n;

        cin>>n;

        li a[n];

        li ans=1;

        f(i,0,n-1)
        {
            cin>>a[i];
        }

        vi cnt(n,0);

        f(i,0,n-1)
        {
            li tp=i+a[i];

            li temp;

            if(tp<0)
            {
                temp=(abs(tp))%n;
                temp=(n-temp)%n;
            }
            else
            {
                temp=tp%n;
            }

            cnt[temp]=1;
        }

        f(i,0,n-1)
        {
            if(cnt[i]==0)
            {
                ans=0;
                break;
            }
        }

        if(ans)
        {
            cout<<"YES\n";
        }
        else
        {
            cout<<"NO\n";
        }
    }

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"
#define debug cout<<"Reached\n";

li fastpow(li base,li exp,li M)
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li t;

    cin>>t;

    while(t--)
    {
        li n;

        cin>>n;

        li a[n];

        li ans=1;

        u_map<li,li> m;

        f(i,0,n-1)
        {
            cin>>a[i];
        }

        vi v;

        f(i,0,n-1)
        {
            if(m.count(i+a[i]))
            {
                ans=0;
            }
            else
            {
                m[i+a[i]]=1;
            }

            v.PB(a[i]+i);
        }

        sort(v.B,v.E);

        u_map<li,li> mp;

        for(li i:v)
        {
            if(mp.count(i-n))
            {
                ans=0;
            }

            mp[i]=1;
        }

        if(ans)
        {
            cout<<"YES\n";
        }
        else
        {
            cout<<"NO\n";
        }
    }

    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
vll par(9),size(1);
ll find_set(ll u)
{
    if(u==par[u]) return u;
    else return par[u]=find_set(par[u]);
}
void union1(ll u,ll v)
{
    u=find_set(u);
    v=find_set(v);
    if(u!=v)
    {
        if(size[u]<size[v])
            swap(u,v);
        size[u]+=size[v];
        par[v]=u;
    }
}
ll mod=1e9+7;
ll mex(ll x, ll n)
{
    if(n==0) return 1;
    else if((n%2)==0) return mex((x*x)%mod,n/2);
    else return (x*mex((x*x)%mod,n/2))%mod;
}
ll fac[100001];
void  call(ll n)
{   ll i;
    ll ans=1;
    fac[0]=1;
    for(i=1;i<=n;i++)
    fac[i]=((fac[i-1]%mod)*(i%mod))%mod;
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=(ans*(fac[n]%mod))%mod;
    ans=((ans%mod)*(mex(fac[r],mod-2)))%mod;
    ans=((ans%mod)*(mex(fac[n-r],mod-2)))%mod;
    return ans;
}

void solve()
{
    ll i,j,k,l,n,m;
    cin>>n;
    ll arr[n];
    unordered_map<ll,ll> mp;
    ll flag=1;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];

        if(mp[(i+arr[i])%n]==0)
        {
            mp[(i+arr[i])%n]=1;
        }
        else
        {
            flag=0;
        }
    }
 if(flag==1)
 cout<<"YES\n";
 else cout<<"NO\n";
}
int main() {
  ll t;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(NULL);
  t=1;
  cin>>t;
 while(t--)
   solve();

}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
vll par(9),size(1);
ll find_set(ll u)
{
    if(u==par[u]) return u;
    else return par[u]=find_set(par[u]);
}
void union1(ll u,ll v)
{
    u=find_set(u);
    v=find_set(v);
    if(u!=v)
    {
        if(size[u]<size[v])
            swap(u,v);
        size[u]+=size[v];
        par[v]=u;
    }
}
ll mod=1e9+7;
ll mex(ll x, ll n)
{
    if(n==0) return 1;
    else if((n%2)==0) return mex((x*x)%mod,n/2);
    else return (x*mex((x*x)%mod,n/2))%mod;
}
ll fac[100001];
void  call(ll n)
{   ll i;
    ll ans=1;
    fac[0]=1;
    for(i=1;i<=n;i++)
    fac[i]=((fac[i-1]%mod)*(i%mod))%mod;
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=(ans*(fac[n]%mod))%mod;
    ans=((ans%mod)*(mex(fac[r],mod-2)))%mod;
    ans=((ans%mod)*(mex(fac[n-r],mod-2)))%mod;
    return ans;
}

void solve()
{
    ll i,j,k,l,n,m;
    cin>>n;
    ll arr[n];
    unordered_map<ll,ll> mp;
    ll flag=1;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        if((i+arr[i])<0)
        {
            k=n+(i+arr[i])%n;
        }
        else k=(i+arr[i])%n;
        if(mp[k]==0)
        {
            mp[k]=1;
        }
        else
        {
            flag=0;
        }
    }
 if(flag==1)
 cout<<"YES\n";
 else cout<<"NO\n";
}
int main() {
  ll t;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(NULL);
  t=1;
  cin>>t;
 while(t--)
   solve();

}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
vll par(9),size(1);
ll find_set(ll u)
{
    if(u==par[u]) return u;
    else return par[u]=find_set(par[u]);
}
void union1(ll u,ll v)
{
    u=find_set(u);
    v=find_set(v);
    if(u!=v)
    {
        if(size[u]<size[v])
            swap(u,v);
        size[u]+=size[v];
        par[v]=u;
    }
}
ll mod=1e9+7;
ll mex(ll x, ll n)
{
    if(n==0) return 1;
    else if((n%2)==0) return mex((x*x)%mod,n/2);
    else return (x*mex((x*x)%mod,n/2))%mod;
}
ll fac[100001];
void  call(ll n)
{   ll i;
    ll ans=1;
    fac[0]=1;
    for(i=1;i<=n;i++)
    fac[i]=((fac[i-1]%mod)*(i%mod))%mod;
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=(ans*(fac[n]%mod))%mod;
    ans=((ans%mod)*(mex(fac[r],mod-2)))%mod;
    ans=((ans%mod)*(mex(fac[n-r],mod-2)))%mod;
    return ans;
}

void solve()
{
    ll i,j,k,l,n,m;
    cin>>n;
    ll arr[n];
    unordered_map<ll,ll> mp;
    ll flag=1;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        if(arr[i]>0)
        {
            arr[i]=(i+arr[i]%n);

        }
        else if(arr[i]<0)
        {   if((abs(arr[i]))%n!=0)
            arr[i]=(i+n-(abs(arr[i]))%n);

        }
        else
        {
            arr[i]=n;

        }
         if(mp[arr[i]]==0)
            {
                mp[arr[i]]=1;
            }
            else
            {
                flag=0;
            }
    }
    if(flag==1) cout<<"YES\n";
    else cout<<"NO\n";
}
int main() {
  ll t;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(NULL);
  t=1;
  cin>>t;
 while(t--)
   solve();

}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
vll par(9),size(1);
ll find_set(ll u)
{
    if(u==par[u]) return u;
    else return par[u]=find_set(par[u]);
}
void union1(ll u,ll v)
{
    u=find_set(u);
    v=find_set(v);
    if(u!=v)
    {
        if(size[u]<size[v])
            swap(u,v);
        size[u]+=size[v];
        par[v]=u;
    }
}
ll mod=1e9+7;
ll mex(ll x, ll n)
{
    if(n==0) return 1;
    else if((n%2)==0) return mex((x*x)%mod,n/2);
    else return (x*mex((x*x)%mod,n/2))%mod;
}
ll fac[100001];
void  call(ll n)
{   ll i;
    ll ans=1;
    fac[0]=1;
    for(i=1;i<=n;i++)
    fac[i]=((fac[i-1]%mod)*(i%mod))%mod;
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=(ans*(fac[n]%mod))%mod;
    ans=((ans%mod)*(mex(fac[r],mod-2)))%mod;
    ans=((ans%mod)*(mex(fac[n-r],mod-2)))%mod;
    return ans;
}

void solve()
{
    ll i,j,k,l,n,m;
    cin>>n;
    ll arr[n+1];
    unordered_map<ll,ll> mp;
    ll flag=1;
    for(i=1;i<=n;i++)
    {
        cin>>arr[i];
        if(arr[i]>0)
        {
            arr[i]=(i+arr[i]%n);
            if(mp[arr[i]]==0)
            {
                mp[arr[i]]=1;
            }
            else
            {
                flag=0;
            }
        }
        else
        {
            arr[i]=(i+n-(abs(arr[i]))%n);
             if(mp[arr[i]]==0)
            {
                mp[arr[i]]=1;
            }
            else
            {
                flag=0;
            }
        }
    }
    if(flag==1) cout<<"YES\n";
    else cout<<"NO\n";
}
int main() {
  ll t;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(NULL);
  t=1;
  cin>>t;
 while(t--)
   solve();

}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
vll par(9),size(1);
ll find_set(ll u)
{
    if(u==par[u]) return u;
    else return par[u]=find_set(par[u]);
}
void union1(ll u,ll v)
{
    u=find_set(u);
    v=find_set(v);
    if(u!=v)
    {
        if(size[u]<size[v])
            swap(u,v);
        size[u]+=size[v];
        par[v]=u;
    }
}
ll mod=1e9+7;
ll mex(ll x, ll n)
{
    if(n==0) return 1;
    else if((n%2)==0) return mex((x*x)%mod,n/2);
    else return (x*mex((x*x)%mod,n/2))%mod;
}
ll fac[100001];
void  call(ll n)
{   ll i;
    ll ans=1;
    fac[0]=1;
    for(i=1;i<=n;i++)
    fac[i]=((fac[i-1]%mod)*(i%mod))%mod;
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=(ans*(fac[n]%mod))%mod;
    ans=((ans%mod)*(mex(fac[r],mod-2)))%mod;
    ans=((ans%mod)*(mex(fac[n-r],mod-2)))%mod;
    return ans;
}

void solve()
{
    ll i,j,k,l,n,m;
    cin>>n;
    ll arr[n];
    unordered_map<ll,ll> mp;

    ll flag=1;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        if((i+arr[i])<0)
        {
            k=n-(-(i+arr[i]))%n;
        }
        else k=(i+arr[i])%n;
        if(mp[k]==0)
        {
            mp[k]=1;
        }
        else
        {
            flag=0;
        }
    }
 if(flag==1)
 cout<<"YES\n";
 else cout<<"NO\n";
}
int main() {
  ll t;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(NULL);
  t=1;
  cin>>t;
 while(t--)
   solve();

}


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define vll vector<ll>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};
vll par(9),size(1);
ll find_set(ll u)
{
    if(u==par[u]) return u;
    else return par[u]=find_set(par[u]);
}
void union1(ll u,ll v)
{
    u=find_set(u);
    v=find_set(v);
    if(u!=v)
    {
        if(size[u]<size[v])
            swap(u,v);
        size[u]+=size[v];
        par[v]=u;
    }
}
ll mod=1e9+7;
ll mex(ll x, ll n)
{
    if(n==0) return 1;
    else if((n%2)==0) return mex((x*x)%mod,n/2);
    else return (x*mex((x*x)%mod,n/2))%mod;
}
ll fac[100001];
void  call(ll n)
{   ll i;
    ll ans=1;
    fac[0]=1;
    for(i=1;i<=n;i++)
    fac[i]=((fac[i-1]%mod)*(i%mod))%mod;
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=(ans*(fac[n]%mod))%mod;
    ans=((ans%mod)*(mex(fac[r],mod-2)))%mod;
    ans=((ans%mod)*(mex(fac[n-r],mod-2)))%mod;
    return ans;
}

void solve()
{
    ll i,j,k,l,n,m;
    cin>>n;
    ll arr[n];
    unordered_map<ll,ll> mp;

    ll flag=1;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        k=(i+arr[i])%n;
        k=(k+n)%n;
        if(mp[k]==0)
        {
            mp[k]=1;
        }
        else
        {
            flag=0;
        }
    }
 if(flag==1)
 cout<<"YES\n";
 else cout<<"NO\n";
}
int main() {
  ll t;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(NULL);
  t=1;
  cin>>t;
 while(t--)
   solve();

}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vll vector<ll>
#define f(j, n) for(ll i=j ; i<n ; i++)
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int main()
{
    ll t,n,i,k;
    cin>>t;
    while(t--)
    {
        cin>>n;
        ll a[n],x[2*n]={0};
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            a[i]=a[i]%n;
            if(a[i]<0)
                a[i]=n-a[i];
            a[i]=(i+a[i])%n;
        }
        sort(a,a+n);
        ll ans=1,count=0;
        for(i=0;i<n;i++)
        {
            if(x[a[i]]==0)
            {
                x[a[i]]++;
            }
            else
            {
                ans=0;
                break;
            }
        }
        if(ans||n==1)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vll vector<ll>
#define f(j, n) for(ll i=j ; i<n ; i++)
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int main()
{
    ll t,n,i,k;
    cin>>t;
    while(t--)
    {
        cin>>n;
        ll count=0,ma=INT_MIN,mi=INT_MAX;
        ll a[n];
        for(i=0;i<n;i++)
            cin>>a[i];
        for(i=0;i<n;i++)
        {
            ll y=(i+a[i])%n;
            if(y<0)
                y=n+y;
            count+=y;
        }
        if(count==(n*(n-1))/2)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vll vector<ll>
#define f(j, n) for(ll i=j ; i<n ; i++)
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int main()
{
    ll t,n,i,k;
    cin>>t;
    while(t--)
    {
        cin>>n;
        ll count=0,ma=INT_MIN,mi=INT_MAX;
        ll a[n];
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            a[i]=a[i]%n;
            if(a[i]<0)
                a[i]=n-a[i];
        }
        for(i=0;i<n;i++)
        {
            count+=(a[i]+i)%n;
        }
        if(count==(n*(n-1))/2)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vll vector<ll>
#define f(j, n) for(ll i=j ; i<n ; i++)
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int main()
{
    ll t,n,i,k;
    cin>>t;
    while(t--)
    {
        cin>>n;
        ll flag=1;
        ll a[n],x[n]={0};
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            if(flag)
            {
                a[i]=a[i]%n;
                if(a[i]<0)
                    a[i]=n+a[i];
                if(x[(i+a[i])%n]==0)
                    x[(i+a[i])%n]++;
                else
                {
                    flag=0;
                }
            }
        }
        if(flag)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vll vector<ll>
#define f(j, n) for(ll i=j ; i<n ; i++)
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int main()
{
    ll t,n,i,k;
    cin>>t;
    while(t--)
    {
        cin>>n;
        ll count=0,ma=INT_MIN,mi=INT_MAX;
        ll a[n];
        for(i=0;i<n;i++)
        {
            cin>>a[i];
            a[i]=a[i]%n;
            if(a[i]<0)
                a[i]=n+a[i];
        }
        for(i=0;i<n;i++)
        {
            count+=(a[i]+i)%n;
        }
        if(count==(n*(n-1))/2)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define vll vector<ll>
#define f(j, n) for(ll i=j ; i<n ; i++)
ll power(ll x, ll y)
{
    if (y == 0)
        return 1;
    else if (y % 2 == 0)
        return power(x, y / 2) * power(x, y / 2);
    else
        return x * power(x, y / 2) * power(x, y / 2);
}
int main()
{
    ll t,n,i,k;
    cin>>t;
    while(t--)
    {
        cin>>n;
        ll count=0,ma=INT_MIN,mi=INT_MAX;
        ll a[n];
        for(i=0;i<n;i++)
            cin>>a[i];
        for(i=0;i<n;i++)
        {
            ll y=(i+a[i])%n;
            if(y<0)
                y=n+y;
            count+=y+1;
        }
        if(count==(n*(n+1))/2)
            cout<<"YES\n";
        else
            cout<<"NO\n";
    }
}


#include<bits/stdc++.h>

#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define eb emplace_back
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define revsort(x) sort(all(x),greater<int>())
using namespace std;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

std::vector<int> clean(std::vector<int> v)
{
    for(int i=0;i<v.size();i++)
        v[i]=0;

    return v;
}

bool pyramid(ll x)
{
    long double sr=sqrt(1+24*x);

    if((sr - floor(sr)) == 0)
    {
        if((((ll)sr -1)%(ll)6)==0)
            return true;
        else
            return false;
    }
    else
        return false;
}

int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,i,j,k,t,c,m,temp,row,col,sm,lr,ans;
    cin>>t;
    bool flag;
    string s;
    //std::vector<std::vector<int>> v;

    //std::vector<ll> each;
    while(t--)
    {

      flag=false;
      cin>>n;
      std::vector<ll> integ;
      ll each[n];

      fo(i,n)
        each[i]=0;

      fo(i,n)
      {
         cin>>temp;
         integ.eb(temp);
      }

      fo(i,n)
      {
        ll val= (i+ integ[i%n]);

        val=val%n;

        if(val>=0 && val<n)
            each[val]++;
        else
        {
             val=val%n;
            each[val]++;
        }

      }

      fo(i,n)
      {

        if(each[i]>1)
        {
            flag=true;
            cout<<"NO"<<endl;
            break;
        }

      }

      if(!flag)
        cout<<"YES"<<endl;

      integ.clear();
      //each.clear();

    }

    //cout<<getCurrentTime();
    return 0;

}


#include<bits/stdc++.h>

#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define eb emplace_back
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define revsort(x) sort(all(x),greater<int>())
using namespace std;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

std::vector<int> clean(std::vector<int> v)
{
    for(int i=0;i<v.size();i++)
        v[i]=0;

    return v;
}

bool pyramid(ll x)
{
    long double sr=sqrt(1+24*x);

    if((sr - floor(sr)) == 0)
    {
        if((((ll)sr -1)%(ll)6)==0)
            return true;
        else
            return false;
    }
    else
        return false;
}

int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,i,j,k,t,c,m,temp,row,col,sm,lr,ans;
    cin>>t;
    bool flag;
    string s;
    //std::vector<std::vector<int>> v;

    //std::vector<ll> each;
    while(t--)
    {

      flag=false;
      cin>>n;
      std::vector<ll> integ;
      int each[n];

      fo(i,n)
        each[i]=0;

      fo(i,n)
      {
         cin>>temp;
         integ.eb(temp);
      }

      fo(i,n)
      {
        ll val= (i+ integ[i%n]);

        val=val%n;

        each[val]++;

      }

      fo(i,n)
      {

        if(each[i]>1)
        {
            flag=true;
            cout<<"NO"<<endl;
            break;
        }

      }

      if(!flag)
        cout<<"YES"<<endl;

      integ.clear();
      //each.clear();

    }

    //cout<<getCurrentTime();
    return 0;

}


#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,t;
	cin>>t;
	while(t--){
		cin>>n;
		set<int>s;
		for(int i=0,x;i<n;i++){
			cin>>x;
			s.insert(((x+i)%n+n)%n);
		}
		puts(s.size()==n?"YES":"NO");
	}
	return 0;
}


#include<bits/stdc++.h>

#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define eb emplace_back
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define revsort(x) sort(all(x),greater<int>())
using namespace std;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

std::vector<int> clean(std::vector<int> v)
{
    for(int i=0;i<v.size();i++)
        v[i]=0;

    return v;
}

bool pyramid(ll x)
{
    long double sr=sqrt(1+24*x);

    if((sr - floor(sr)) == 0)
    {
        if((((ll)sr -1)%(ll)6)==0)
            return true;
        else
            return false;
    }
    else
        return false;
}

int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,i,j,k,t,c,m,temp,row,col,sm,lr,ans;
    cin>>t;
    bool flag;
    string s;
    //std::vector<std::vector<int>> v;

    //std::vector<ll> each;
    while(t--)
    {

      flag=false;
      cin>>n;
      std::vector<ll> integ;
      int each[n];

      fo(i,n)
        each[i]=0;

      fo(i,n)
      {
         cin>>temp;
         integ.eb(temp);
      }

      fo(i,n)
      {
        ll val= (i+ integ[i%n]);

        val=val%n;

        each[val]= each[val]+1;

      }

      fo(i,n)
      {

        if(each[i]>1)
        {
            flag=true;
            cout<<"NO"<<endl;
            break;
        }

      }

      if(!flag)
        cout<<"YES"<<endl;

      integ.clear();
      //each.clear();

    }

    //cout<<getCurrentTime();
    return 0;

}


#include<bits/stdc++.h>

#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define eb emplace_back
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define revsort(x) sort(all(x),greater<int>())
using namespace std;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

std::vector<int> clean(std::vector<int> v)
{
    for(int i=0;i<v.size();i++)
        v[i]=0;

    return v;
}

bool pyramid(ll x)
{
    long double sr=sqrt(1+24*x);

    if((sr - floor(sr)) == 0)
    {
        if((((ll)sr -1)%(ll)6)==0)
            return true;
        else
            return false;
    }
    else
        return false;
}

int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,i,j,k,t,c,m,temp,row,col,sm,lr,ans;
    cin>>t;
    bool flag;
    string s;
    //std::vector<std::vector<int>> v;

    //std::vector<ll> each;
    while(t--)
    {

      flag=false;
      cin>>n;
      std::vector<ll> integ;
      ll each[n];

      fo(i,n)
        each[i]=0;

      fo(i,n)
      {
         cin>>temp;
         integ.eb(temp);
      }

      fo(i,n)
      {
        ll val= (i+ integ[i%n]);

        val=val%n;

        each[val]++;

      }

      fo(i,n)
      {

        if(each[i]>1)
        {
            flag=true;
            cout<<"NO"<<endl;
            break;
        }

      }

      if(!flag)
        cout<<"YES"<<endl;

      integ.clear();
      //each.clear();

    }

    //cout<<getCurrentTime();
    return 0;

}


#include<bits/stdc++.h>

#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define eb emplace_back
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define revsort(x) sort(all(x),greater<int>())
using namespace std;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

std::vector<int> clean(std::vector<int> v)
{
    for(int i=0;i<v.size();i++)
        v[i]=0;

    return v;
}

bool pyramid(ll x)
{
    long double sr=sqrt(1+24*x);

    if((sr - floor(sr)) == 0)
    {
        if((((ll)sr -1)%(ll)6)==0)
            return true;
        else
            return false;
    }
    else
        return false;
}

int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,i,j,k,t,c,m,temp,row,col,sm,lr,ans;
    cin>>t;
    bool flag;
    string s;
    //std::vector<std::vector<int>> v;

    //std::vector<ll> each;
    while(t--)
    {

      flag=false;
      cin>>n;
      std::vector<ll> integ;
      ll each[n];

      fo(i,n)
        each[i]=0;

      fo(i,n)
      {
         cin>>temp;
         integ.eb(temp);
      }

      fo(i,n)
      {
        ll val= (i+ integ[i%n]);

        val=val%n;

        if(val>=0 && val<n)
            each[val]++;

      }

      fo(i,n)
      {

        if(each[i]>1 || each[i]<0)
        {
            flag=true;
            cout<<"NO"<<endl;
            break;
        }

      }

      if(!flag)
        cout<<"YES"<<endl;

      integ.clear();
      //each.clear();

    }

    //cout<<getCurrentTime();
    return 0;

}


#include<bits/stdc++.h>

#define ll long long int
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define eb emplace_back
#define PI 3.1415926535897932384626
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define revsort(x) sort(all(x),greater<int>())
using namespace std;

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}

std::vector<int> clean(std::vector<int> v)
{
    for(int i=0;i<v.size();i++)
        v[i]=0;

    return v;
}

bool pyramid(ll x)
{
    long double sr=sqrt(1+24*x);

    if((sr - floor(sr)) == 0)
    {
        if((((ll)sr -1)%(ll)6)==0)
            return true;
        else
            return false;
    }
    else
        return false;
}

int main()
{
    startTime = (double)clock();
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,i,j,k,t,c,m,temp,row,col,sm,lr,ans;
    cin>>t;
    bool flag;
    string s;
    //std::vector<std::vector<int>> v;

    //std::vector<ll> each;
    while(t--)
    {

      flag=false;
      cin>>n;
      std::vector<ll> integ;
      std::vector<int> each(n,0);
      fo(i,n)
      {
         cin>>temp;
         integ.eb(temp);
      }

      fo(i,n)
      {
        ll val= (i+ integ[i%n]);

        val%=n;

        each[val]++;

      }

      fo(i,n)
      {

        if(each[i]>1)
        {
            flag=true;
            cout<<"NO"<<endl;
            break;
        }

      }

      if(!flag)
        cout<<"YES"<<endl;

      integ.clear();
      each.clear();

    }

    //cout<<getCurrentTime();
    return 0;

}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		int n; cin >> n;

		int x;
		set<int> s;
		for(int i = 0; i < n; i++)
		{
			cin >> x;

			s.insert(abs((i+x) % n));
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		ll n; cin >> n;

		ll x;
		set<ll> s;

		for(ll i = 0; i < n; i++)
		{
			cin >> x;

			s.insert((i + x) % n);
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		ll n; cin >> n;

		ll x;
		set<ll> s;

		for(ll i = 0; i < n; i++)
		{
			cin >> x;
			s.insert((x + i + n) % n);
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		ll n; cin >> n;

		ll x;
		set<ll> s;

		for(ll i = 0; i < n; i++)
		{
			cin >> x;

			s.insert(abs((i+x) % n));
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		ll n; cin >> n;

		ll x;
		set<ll> s;

		for(ll i = 0; i < n; i++)
		{
			cin >> x;

			s.insert(abs((i+x)) % n);
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    set<int> s;

    while(t--)
    {

		int n; cin >> n;

		int x;

		for(int i = 0; i < n; i++)
		{
			cin >> x;

			s.insert(abs((i+x) % n));
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		int n; cin >> n;

		int last, cur;

		cin >> last;

		bool ok = true;

		for(int i = 1; i < n; i++)
		{
			cin >> cur;

			if(abs(cur-last)==1) ok = false;

			last = cur;
		}

		cout << (ok?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

const int INF = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		ll n; cin >> n;

		ll x;
		set<ll> s;

		for(ll i = 0; i < n; i++)
		{
			cin >> x;
			s.insert(((x<0?x+INF*n:x) + i) % n);
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


// g++ -std=gnu++1y -O2 -I/opt/boost/gcc/include -L/opt/boost/gcc/lib -o ./a.out ./X.cpp & a.out //
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t; cin >> t;

    while(t--)
    {

		ll n; cin >> n;

		ll x;
		set<ll> s;

		for(ll i = 0; i < n; i++)
		{
			cin >> x;
			s.insert((abs(x) + i) % n);
		}

		cout << (s.size()==n?"YES":"NO") << '\n';

	}

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int t; cin >>t;
  for(int tc=1;tc<=t;tc++){
      long long int n; cin >>n;
      long long int a[n];
      for(long long int i=0;i<n;i++)cin>>a[i];
      unordered_map<long long int,long long int>m;
      int f=1;
      for(long long int i=0;i<n;i++){
          long long int idx=i%n;
          long long int j=(i+a[idx])%n;
          m[j]++;
          if(m[j]>=2){f=0;break;}
      }
      if(f)cout<<"YES"<<endl;
      else cout <<"NO"<<endl;
  }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int t; cin >>t;
  for(int tc=1;tc<=t;tc++){
      long long int n; cin >>n;
      long long int a[n];
      for(long long int i=0;i<n;i++)cin>>a[i];
      unordered_map<long long int,long long int>m;
      int f=1;
      for(long long int i=0;i<n;i++){
          long long int idx=i%n;
          long long int j=((i+a[idx])+n)%n;
          m[j]++;
          if(m[j]>=2){f=0;break;}
      }
      if(f)cout<<"YES"<<endl;
      else cout <<"NO"<<endl;
  }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int t; cin >>t;
  for(int tc=1;tc<=t;tc++){
      long long int n; cin >>n;
      long long int a[n];
      for(long long int i=0;i<n;i++)cin>>a[i];
      unordered_map<long long int,long long int>m;
      int f=1;
      for(long long int i=-1e6;i<=1e6;i++){
          long long int idx=i%n;
          long long int j=i+a[idx];
          m[j]++;
          if(m[j]>=2){f=0;break;}
      }
      if(f)cout<<"YES"<<endl;
      else cout <<"NO"<<endl;
  }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int t; cin >>t;
  for(int tc=1;tc<=t;tc++){
      long long int n; cin >>n;
      long long int a[n];
      for(long long int i=0;i<n;i++)cin>>a[i];
      unordered_map<long long int,long long int>m;
      int f=1;
      for(long long int i=0;i<n;i++){
        long long int tmp=((i+a[i])%n+n)%n;
        m[tmp]++;
        if(m[tmp]>=2){f=0;break;}
      }
      if(!f)cout<<"NO"<<endl;
      else cout <<"YES"<<endl;
  }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int t; cin >>t;
  for(int tc=1;tc<=t;tc++){
      long long int n; cin >>n;
      long long int a[n];
      for(long long int i=0;i<n;i++)cin>>a[i];
      unordered_map<long long int,long long int>m;
      int f=1;
      for(long long int i=0;i<n;i++){
        long long int tmp=((i+a[i])%n+n)%n;
        m[tmp]++;
        if(m[tmp]>=2){f=0;break;}
      }
      if(f)cout<<"YES"<<endl;
      else cout <<"NO"<<endl;
  }
}


#include <bits/stdc++.h>

using namespace std;

int main() {
  int t; cin >>t;
  for(int tc=1;tc<=t;tc++){
      long long int n; cin >>n;
      long long int a[n];
      for(long long int i=0;i<n;i++)cin>>a[i];
      unordered_map<long long int,long long int>m;
      int f=1;
      for(long long int i=0;i<=n;i++){
          long long int idx=i%n;
          long long int j=i+a[idx];
          m[j]++;
          if(m[j]>=2){f=0;break;}
      }
      if(f)cout<<"YES"<<endl;
      else cout <<"NO"<<endl;
  }
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], le[x]}, x});
  q.erase({{-len[y], le[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], le[x]}, x});
}

void join2(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

//  q.erase({{-len[x], val[x]}, x});
  q.erase({{-len[x], le[x]}, x});

  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], le[x]}, x});
//  q.insert({{-len[x], val[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, i}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  int L = 0, R = n-1;
  while (!q.empty()) {

//    dbg("currently");
//    for (auto pp : q) {
//      dbg(pp);
//    }

    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;

    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];
//    dbg("select", p, l, r);
    if (l > L && r < R) {
      if (val[get(l-1)] == val[get(r + 1)]) {
        join(l - 1, r + 1);
      } else {
        len[rep] = 0;
        val[rep] = val[get(l-1)];
        join2(l - 1, l);
      }
    } else {
      if (l == L) {
        L = r + 1;
      } else {
        R = l - 1;
      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], val[x]}, x});
  q.erase({{-len[y], val[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], val[x]}, x});
}

void join2(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

//  q.erase({{-len[x], val[x]}, x});

  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

//  q.insert({{-len[x], val[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, a[i]}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  int L = 0, R = n-1;
  while (!q.empty()) {

//    dbg("currently");
//    for (auto pp : q) {
//      dbg(pp);
//    }

    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;
//    dbg("select", p);
    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];
    if (l > L && r < R) {
      if (val[get(l-1)] == val[get(r + 1)]) {
        join(l - 1, r + 1);
      } else {
        len[rep] = 0;
        val[rep] = val[get(l-1)];
        join2(l - 1, l);
      }
    } else {
      if (l == L) {
        L = r + 1;
      } else {
        R = l - 1;
      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

#define dbg(...) ;

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], val[x]}, x});
  q.erase({{-len[y], val[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], val[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, a[i]}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  int L = 0, R = n-1;
  while (!q.empty()) {

    dbg("currently");
    for (auto pp : q) {
      dbg(pp);
    }

    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;
    dbg("select", p);
    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];
    if (l > L && r < R) {
      if (val[get(l-1)] == val[get(r + 1)]) {
        join(l - 1, r + 1);
      } else {
        len[rep] = 0;
        val[rep] = val[get(l-1)];
        join(l - 1, l);
      }
    } else {
      if (l == L) {
        L = r + 1;
      } else {
        R = l - 1;
      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], val[x]}, x});
  q.erase({{-len[y], val[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], val[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, a[i]}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  int L = 0, R = n-1;
  while (!q.empty()) {

//    dbg("currently");
//    for (auto pp : q) {
//      dbg(pp);
//    }

    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;
//    dbg("select", p);
    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];
    if (l > L && r < R) {
      if (val[get(l-1)] == val[get(r + 1)]) {
        join(l - 1, r + 1);
      } else {
        len[rep] = 0;
        val[rep] = val[get(l-1)];
        join(l - 1, l);
      }
    } else {
      if (l == L) {
        L = r + 1;
      } else {
        R = l - 1;
      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

#define dbg(...) ;

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], val[x]}, x});
  q.erase({{-len[y], val[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], val[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, a[i]}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  while (!q.empty()) {

    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;
    dbg(p);
    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];

    len[rep] = 0;
    if (l > 0 && r < n - 1) {
      if (val[get(l-1)] == val[get(r + 1)]) {

        int len1 = len[get(l-1)], len2 = len[get(r + 1)];
        int v1 = val[get(l-1)];
        int l1 = le[get(l-1)], r1 = ri[get(r + 1)];

        val[rep] = val[get(l-1)];
        join(l - 1, l);
        join(r, r + 1);

        rep = get(l-1);

        if (len[rep] != len1 + len2) {
          throw 42;
        }
        // All good
        if (le[rep] != l1 || ri[rep] != r1) {
          throw 42;
        }
        if (val[rep] != v1) {
          throw 42;
        }
        if (!q.count({{-len[rep], val[rep]}, rep})) {
          throw 42;
        }

      } else {
        val[rep] = val[get(l - 1)];
        join(l - 1, l);
      }
    } else {
//      if (l > 0) {
//        val[rep] = val[get(l - 1)];
//        join(l - 1, l);
//      } else if (r < n - 1) {
//        val[rep] = val[get(r + 1)];
//        join(r, r + 1);
//      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

#define dbg(...) ;

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], val[x]}, x});
  q.erase({{-len[y], val[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);
  q.insert({{-len[x], val[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, a[i]}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  while (!q.empty()) {

    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;
    dbg(p);
    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];

    len[rep] = 0;
    if (l > 0 && r < n - 1) {
      if (val[get(l-1)] == val[get(r + 1)]) {
        val[rep] = val[get(l-1)];
        join(l - 1, l);
        join(r, r + 1);
      }
    } else {
      if (l > 0) {
        val[rep] = val[get(l - 1)];
        join(l - 1, l);
      } else if (r < n - 1) {
        val[rep] = val[get(r + 1)];
        join(r, r + 1);
      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

vec<int> par, rnk;
vec<int> len, le, ri;
set<pair<int, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({-len[x], x});
  q.erase({-len[y], y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({-len[x], get(x)});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({-1, i});
    par[i] = le[i] = ri[i] = i;
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  while (!q.empty()) {
    ++res;
    auto p = *q.begin();
    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];

    len[rep] = 0;
    if (l > 0) {
      join(l - 1, l);
    }
    if (r < n - 1) {
      join(r, r + 1);
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

#define dbg(...) ;

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) throw 42;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], val[x]}, x});
  q.erase({{-len[y], val[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], val[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, a[i]}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  while (!q.empty()) {

    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;
    dbg(p);
    q.erase(q.begin());

    int rep = get(p.second);
    int l = le[rep], r = ri[rep];

    len[rep] = 0;
    if (l > 0 && r < n - 1) {
      if (val[get(l-1)] == val[get(r + 1)]) {
        val[rep] = val[get(l-1)];
        join(l - 1, l);
        join(r, r + 1);
      } else {
        val[rep] = val[get(l - 1)];
        join(l - 1, l);
      }
    } else {
      if (l > 0) {
        val[rep] = val[get(l - 1)];
        join(l - 1, l);
      } else if (r < n - 1) {
        val[rep] = val[get(r + 1)];
        join(r, r + 1);
      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

template<class T>
using vec = std::vector<T>;

#define FOR(i, n) for (int i = 0; i < (n); ++i)

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

vec<int> par, rnk;
vec<int> val;
vec<int> len, le, ri;
set<pair<pair<int, int>, int>> q;

int get(int x) {
  return x == par[x] ? x : par[x] = get(par[x]);
}

void join(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;

  q.erase({{-len[x], le[x]}, x});
  q.erase({{-len[y], le[y]}, y});

  len[x] += len[y];
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);

  q.insert({{-len[x], le[x]}, x});
}

void join2(int x, int y) {
  x = get(x);
  y = get(y);
  if (x == y) return;
  if (rnk[x] < rnk[y]) swap(x, y);
  rnk[x] += rnk[y];
  par[y] = x;
//  q.erase({{-len[x], le[x]}, x});
  le[x] = min(le[x], le[y]);
  ri[x] = max(ri[x], ri[y]);
//  q.insert({{-len[x], le[x]}, x});
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);
  par = vec<int>(n);
  val = vec<int>(n);
  rnk = vec<int>(n, 1);
  len = vec<int>(n, 1);
  le = vec<int>(n);
  ri = vec<int>(n);
  FOR(i, n) {
    q.insert({{-1, i}, i});
    par[i] = le[i] = ri[i] = i;
    val[i] = a[i];
  }
  FOR(i, n-1) {
    if (a[i] == a[i+1]) {
      join(i, i + 1);
    }
  }

  int res = 0;
  int L = 0, R = n-1;
  while (!q.empty()) {
    auto p = *q.begin();
    if (p.first.first == 0) {
      break;
    }
    ++res;
    q.erase(q.begin());
    int rep = get(p.second);
    int l = le[rep], r = ri[rep];
    if (l > L && r < R) {
      if (val[get(l-1)] == val[get(r + 1)]) {
        join(l - 1, r + 1);
      } else {
        len[rep] = 0;
        val[rep] = val[get(l-1)];
        join2(l - 1, l);
      }
    } else {
      if (l == L) {
        L = r + 1;
      } else {
        R = l - 1;
      }
    }
  }
  out << res << "\n";
}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}


#define NDEBUG
NDEBUG

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cstring>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <memory>
#include <queue>
#include <random>

using namespace std;

// TC_REMOVE_BEGIN
/// caide keep
bool __hack = std::ios::sync_with_stdio(false);
/// caide keep
auto __hack1 = cin.tie(nullptr);
// TC_REMOVE_END

// Section with adoption of array and vector algorithms.

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
//
//template <class T> using StdTree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

namespace template_util {

    constexpr int bytecount(uint64_t x) {
        return x ? 1 + bytecount(x >> 8) : 0;
    }

    template<int N>
    struct bytetype {

    };

    /// caide keep
    template<uint64_t N>
    struct minimal_uint : bytetype<bytecount(N)> {
    };
}

template<class T>
T next(istream& in) {
    T ret;
    in >> ret;
    return ret;
}

template<class T>
vector<T> next_vec(istream& in, size_t n) {
  vector<T> ret(n);
  for (size_t i = 0; i < n; ++i) {
    ret[i] = next<T>(in);
  }
  return ret;
}

void solve(istream& in, ostream& out) {
  auto n = next<int>(in);
  auto a = next_vec<int>(in, n);

  set<pair<int, int>> lenToLeft;
  map<int, int> leftToColor;
  map<int, int> leftToRight;
  map<int, int> leftToLen;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      if (a[j] != a[i] || j == n-1) {
        if (j == n-1 && a[j] == a[i]) {
          ++j;
        }
        lenToLeft.insert({-(j - i), i + 1});
        leftToColor[i + 1] = a[i];
        leftToRight[i + 1] = j;
        leftToLen[i + 1] = j - i;
        i = j - 1;
        break;
      }
    }
  }
  lenToLeft.insert({1, 0});
  leftToColor[0] = -1;
  leftToLen[0] = 1;
  leftToRight[0] = 0;

  lenToLeft.insert({1, n + 1});
  leftToColor[n + 1] = -2;
  leftToLen[n + 1] = 1;
  leftToRight[n + 1] = n+1;

  int res = 0;
  while (lenToLeft.size() > 2) {
    ++res;
    auto interval = *lenToLeft.begin();
    lenToLeft.erase(lenToLeft.begin());

    int le = interval.second;

    auto it = leftToColor.find(le);
    --it;
    int col = it->second;
    int from1 = it->first;
    ++it;
    ++it;
    int col2 = it->second;
    int from2 = it->first;
    int to2 = leftToRight[from2];
    --it;

    leftToRight.erase(le);
    leftToColor.erase(le);
    leftToLen.erase(le);

    if (col != col2) {
      continue;
    }
    leftToColor.erase(from1);
    leftToColor.erase(from2);
    leftToRight.erase(from1);
    leftToRight.erase(from2);
    int len1 = leftToLen[from1];
    int len2 = leftToLen[from2];
    leftToLen.erase(from1);
    leftToLen.erase(from2);

    lenToLeft.erase({-len1, from1});
    lenToLeft.erase({-len2, from2});

    lenToLeft.insert({-( len1 + len2), from1});
    leftToLen[from1] = len1 + len2;
    leftToRight[from1] = to2;
    leftToColor[from1] = col;
  }
  out << res << "\n";

}

//#include <fstream>

int main() {
//  ifstream fin("bridges.in");
//  ofstream fout("bridges.out");
    solve(cin, cout);
//  solve(fin, fout);
    return 0;
}