    // وَأَن لَّيْسَ لِلْإِنسَانِ إِلَّا مَا سَعَىٰ (39) وَأَنَّ سَعْيَهُ سَوْفَ يُرَىٰ (40)

    /* 
        author: Mazen Mohamed
    */
    #include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>

    using namespace std;
    using namespace __gnu_pbds;
    using ll = long long;
    using ld = long double;

    #define all(x)  x.begin(),x.end()
    #define v(x) vector<x>
    #define nl '\n'
    #define sp ' '
    #define fxd(x) fixed << setprecision(x)
    template<class t> using ordered_set = tree<t, null_type, less<t>, rb_tree_tag, tree_order_statistics_node_update>;
    template<class t> using ordered_multiset = tree<t, null_type, less_equal<t>, rb_tree_tag, tree_order_statistics_node_update>;

    ll mod = 1e9 + 7;
    ld pi = acos(-1);

    ll dr[8] = {0, 0, 1, -1, 1, 1, -1, -1};
    ll dc[8] = {1, -1, 0, 0, 1, -1, 1, -1};

    int n;
    vector<ll> arr;
    unordered_set<ll> st;

    int ln(int i , int j)
    {
        ll fr = i;
        ll sc = j;
        if(fr + sc == 0 ) return 2;
        int curlen = 2;
        while (true)
        {
            if(st.count(fr+sc) == 1)
            {
                int te = sc + fr;
                fr = sc;
                sc = te;
                curlen++;
            }
            else
            {
                return curlen;
            }
        }
        
    }

    void hankasha()
    {
        cin >> n;
        arr.assign(n,0);
        st.clear();
        for (int i = 0; i < n; i++)
        {
            cin >> arr[i];
            st.insert(arr[i]);
        }
        
        sort(all(arr));
        int ans = 2;
        for (int i = 0; i < n; i++)
        {
            for (int j = 0 ; j < n; j++)
            {
                if(i == j) continue;
                ans = max(ans,ln(arr[i],arr[j]));
            }
            
        }
        cout << ans << nl;
    }


    int main()
    {
        ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    
        int t = 1;
        cin >> t;
        while (t--)
        {
            hankasha();
        }
    }