#include<bits/stdc++.h>
#define ll long long
#define int long long
#define re read()
using namespace std;
const int N=3e5+5;
const int NN=3e3+5;
inline ll read(){
ll x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
return x*f;
}
set<int> s;
int ii[N];
signed main(){
ios::sync_with_stdio(false);
int n=re,ty;
for(int iii=1;iii<=n;iii++) {
int t=re,k=re;
if(iii==1)ty=t/86400;
if(t/86400!=ty){
int j=0;
for(auto it : s){
ii[j++]=it;
}
int jj=s.size();
for(int j=1;j<=jj;j++){
s.erase(ii[j]);
}
}
ty=t/86400;
for(int i=1;i<=k;i++){
int x=re;
s.insert(x);
}
cout<<s.size()<<'\n';
}
return 0;
}