#include<iostream>
#include<vector>
#include<unordered_map>
#include<queue>
using namespace std;
struct node
{
int time;
int type;
};
int main()
{
int n;
int t, k;
int temp;
struct node zcs;
unordered_map<int, int>gj;
int count = 0;
queue<node>q;
vector<int>p;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> t >> k;
for (int j = 0; j < k; j++)
{
cin >> temp;
if (gj.find(temp) == gj.end())
{
count++;
gj.insert(pair<int, int>{temp, 0});
}
gj.find(temp)->second++;
zcs.time = t;
zcs.type = temp;
q.push(zcs);
}
while (t - q.front().time >= 86400)
{
gj.find(q.front().type)->second--;
if (gj.find(q.front().type)->second == 0)
{
count--;
}
q.pop();
}
p.push_back(count);
}
for (int i = 0; i < p.size(); i++)
{
cout << p[i] << endl;
}
}