#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector <int> a)
{
int ret = 0;
vector <int> b; //최대 길이 저장
for (int i = 0; i < a.size(); i++) //기준
{
int longest = 0;
for (int j = 0; j < i; j++) //이전의 값들 비교
if (a[j] < a[i] && longest < b[j])
longest = b[j];
b.push_back(longest + 1); //자기 자신 포함
ret = max(ret, b[i]);
}
return ret;
}
int main(void)
{
int C;
cin >> C;
while (C--)
{
int N;
cin >> N;
vector <int> arr;
int temp;
for (int i = 0; i < N; i++)
{
cin >> temp;
arr.push_back(temp);
}
cout << solution(arr) << endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBzb2x1dGlvbih2ZWN0b3IgPGludD4gYSkKewoJaW50IHJldCA9IDA7Cgl2ZWN0b3IgPGludD4gYjsJCS8v7LWc64yAIOq4uOydtCDsoIDsnqUKCWZvciAoaW50IGkgPSAwOyBpIDwgYS5zaXplKCk7IGkrKykJCS8v6riw7KSACgl7CgkJaW50IGxvbmdlc3QgPSAwOwoJCWZvciAoaW50IGogPSAwOyBqIDwgaTsgaisrKQkJCS8v7J207KCE7J2YIOqwkuuTpCDruYTqtZAKCQkJaWYgKGFbal0gPCBhW2ldICYmIGxvbmdlc3QgPCBiW2pdKQoJCQkJbG9uZ2VzdCA9IGJbal07CgoJCWIucHVzaF9iYWNrKGxvbmdlc3QgKyAxKTsJLy/snpDquLAg7J6Q7IugIO2PrO2VqAoJCXJldCA9IG1heChyZXQsIGJbaV0pOwoJfQoJcmV0dXJuIHJldDsKfQoKaW50IG1haW4odm9pZCkKewoJaW50IEM7CgljaW4gPj4gQzsKCgl3aGlsZSAoQy0tKQoJewoJCWludCBOOwoJCWNpbiA+PiBOOwoJCXZlY3RvciA8aW50PiBhcnI7CgoJCWludCB0ZW1wOwoJCWZvciAoaW50IGkgPSAwOyBpIDwgTjsgaSsrKQoJCXsKCQkJY2luID4+IHRlbXA7CgkJCWFyci5wdXNoX2JhY2sodGVtcCk7CgkJfQoJCWNvdXQgPDwgc29sdXRpb24oYXJyKSA8PCBlbmRsOwoJfQp9