#include <bits/stdc++.h>
using namespace std;
inline int read()
{
int x=0;
bool flag=1;
char c=getchar();
while(c<'0'||c>'9')
{
if(c=='-')
flag=0;
c=getchar();
}
while(c>='0'&&c<='9')
{
x=(x<<1)+(x<<3)+c-'0';
c=getchar();
}
return (flag?x:~(x-1));
}
struct p
{
long long t,ne;
} ;
deque<p> q;
p xcy;
int main()
{
ios::sync_with_stdio(false);
long long int f[100001];
long long n,l,ans,sum,ti,b_t;
n=read();
for(int i=0;i<n;i++)
{
xcy.t=xcy.ne=0;
ti=read();
l=read();
for(int o=0;o<l;o++)
{
ans=read();
if(f[ans]==0) { sum++; }
f[ans]++;
xcy.ne=ans;
xcy.t=ti;
q.push_back(xcy);
}
while(2<22)
{
if((ti-q.front().t)>86400)
{
f[q.front().ne]--;
if(f[q.front().ne]==0) { sum--; }
q.pop_front();
}
else break;
}
cout<<sum<<endl;
}
return 0;
}