#include <bits/stdc++.h>   #define MAXN   100001     int spf[MAXN];    using namespace std;      #define mod             1000000007   #define int             long long //32bit as well as 64bit   #define vi              vector<int> // a[n] s[n]  v(n)  pop_back      #define vvi             vector<vector<int>>  // vvi(n)  vec[i]=vi(col);   #define maxx(arr)       *max_element(arr.begin(),arr.end())    #define minn(arr)       *min_element(arr.begin(),arr.end())   #define maxa(arr)       *max_element(arr,arr+arr.size())   #define mina(arr)       *min_element(arr,arr+arr.size())   #define sortt(sv)       sort(sv.begin(),sv.end()) //str & v   rbegin,rend   #define pb              push_back  // s0d and v s.pb(s[i])   #define forr(i,z,n)     for(int i=z;i<n;i++)   // n= name.size()   #define forn(i,n,x)     for(int i=n-1;i>=x;i--)    //for(i+=3) loop last line i+=2;   #define aa(i,st)        for(auto i=st.begin();i!=st.end();i++)  //arr not/*i(vec,set,0Dstring)/mp(i->first)   #define an(i,st)        for(auto i=st.rbegin();i!=st.rend();i++)      #define gcd(a,b)        __gcd(a,b) //0,x=x   #define lcm(a,b)        ((a)*(b)/gcd(a,b)) // 0,x =0     #define con(arr,s);     /*string to array*/int arr[s.size()]={0};for(int i=0;i<s.size();i++){arr[i]=arr[i]*10+(s[i]-48);}      int    binpower                                                                                                 (int base, unsigned int e, int m) {int result = 1;base %= m;while (e) {if (e & 1)result = result * base % m;base = base * base % m;e >>= 1;}return result;}   bool   check_composite                                                                                           (int n, int a, int d, int s) {int x = binpower(a, d, n);if (x == 1 || x == n - 1)return false;for (int r = 1; r < s; r++) {x = x * x % n;if (x == n - 1)return false;}return true;};   bool   prime(int n)    /* 1 is not prime*/                                                                                          { if (n < 2)return false;int r = 0;int d = n - 1;while ((d & 1) == 0) {d >>= 1;r++;}for (int a : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37}) {if (n == a)return true;if (check_composite(n, a, d, r))return false;}return true;}   int    fact (int n)    /*fa(3)=3*2  fa(0)=1    npr=fa(n)/ fac(n-r)      ncr=fa(n)/(fa(n-r)*fa(r))          for aba 3p2=aa ab ba ba aa ab(6)  and 3c2(3) =  ab aa ba (because input is in int)  */      { int res=1; for(int i=2;i<=n;i++) res=res*i; return res;}    void   helperfactor()                                                                                         {spf[1] = 1;for (int i=2; i<MAXN; i++)spf[i] = i;for (int i=4; i<MAXN; i+=2)spf[i] = 2;for (int i=3; i*i<MAXN; i++){if (spf[i] == i){for (int j=i*i; j<MAXN; j+=i)if (spf[j]==j)spf[j] = i;}}}    void   lcmfactor       (vi &ret,int x)                         /*       12= 2 2 3         */                                          { helperfactor();while (x != 1) { ret.push_back(spf[x]); x = x / spf[x];}}    void   primefactor  (vi &arr,int n)                            /*       12= 2 3           */                                                                 {bool prime[n + 1];memset(prime, true, sizeof(prime));for (int p = 2; p * p <= n; p++){if (prime[p] == true){for (int i = p * p; i <= n; i += p)prime[i] = false;}}for (int p = 2; p <= n; p++)if (prime[p])arr.pb(p);}   void   allfactor    (vi &arr,int n)     /*sort to get lexiographically  12= 1 12 2 6 3 4  */                                                 {for (int i=1; i<=sqrt(n); i++){if (n%i == 0){if (n/i == i)arr.pb(i);else{arr.pb(i); arr.pb(n/i);}}}}      // void   longfactor(vi &arr,int n)                                                                           {while (n%2 == 0){arr.pb(2);n = n/2;}for (int i = 3; i <= sqrt(n); i = i+2){while (n%i == 0){arr.pb(i);n = n/i; }}if (n > 2) arr.pb(n); }    // void   helperlongprime(int limit, vi &prime,vi &arr)                                                        {vector<bool> mark(limit + 1, true);for (int p=2; p*p<limit; p++){if (mark[p] == true){for (int i=p*p; i<limit; i+=p)mark[i] = false;}}for (int p=2; p<limit; p++){if (mark[p] == true){prime.push_back(p);arr.pb(p);}}}   // void   longprimefactor(vi &arr,int n)                                                                       {int limit = floor(sqrt(n))+1;vector<int> prime;prime.reserve(limit);helperlongprime(limit, prime,arr);int low = limit;int high = 2*limit;while (low < n){if (high >= n)high = n;bool mark[limit+1];memset(mark, true, sizeof(mark));for (int i = 0; i < prime.size(); i++){int loLim = floor(low/prime[i]) * prime[i];if (loLim < low)loLim += prime[i];for (int j=loLim; j<high; j+=prime[i])mark[j-low] = false;}for (int i = low; i<high; i++)if (mark[i - low] == true)arr.pb(i);low = low + limit;high = high + limit;}}      //use v.size/s=   instead making bool/checkpoints/else if/else     // v(n) imp for cin not for pb               //JAI SARGURU DEV  JAI SATGURU DEV   DONT WASTE TIME   //Dasrath manjhi 22 years  gate 10years  sonu bahiya appu bhaiya kunal akshay alok bhanu me 1 year january 22   //Become financial independent as fast as u can to enjoy life -> STUDENT LIFE,STUDY ONLY   //Dont waste time in finding reason to relax      //  JUST STUDY,NO RELAX,NO REASON   for 1YEAR       void solve(){       int n;   cin>>n;      vi v(n);   forr(i,0,n){       cin>>v[i];   }   int maxy=v[n-1];   vi ans(n);   forn(i,n,0){      ans[i]=v[i];      if(i+ans[i]<n){        ans[i]+=ans[i+ans[i]];      }      if(ans[i]>maxy){       maxy=ans[i];      }   }      cout<<maxy<<  n ;                                    }                              int32_t main(){              ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);       #ifndef ONLINE_JUDGE           freopen( input.txt , r ,stdin);           freopen( output.txt , w ,stdout);       #endif          int t;cin>>t;while(t--)           solve();                     return 0;   }      /*pow(base,power)       sqrt(n)     ceil(cbrt(n))/ceil(n)      long double n = -7.11;       cbrt(n);         gives till .5 point  /long long double not exist   int h= (s[0]- 0 )*10  + s[1]- 0 ;    s.erase(remove(s.begin(),s.end(),  a  ),s.end());        string search in        multimap =mp.insert((pair <int, int> ( fir, sec )));  can have sorted same key and definitely same value     */