#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<utility>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
const int N=1e8+4;
int T;
int mod=1e9+7;
int vis[N];
int main()
{
	freopen("assign.in","r",stdin);
	freopen("assign.out","w",stdout);
	scanf("%d",&T);
	while(T--)
	{
		memset(vis,0,sizeof(vis));
		
		int n,m,v;
		scanf("%d%d%d",&n,&m,&v);
		for(int i=1;i<=m;i++)
		{
			int c,d;
			scanf("%d%d",&c,&d);
			vis[c]=1;
		}
		int flag=0,flag2=0;
		int ans=0;
		for(int i=1;i<=n;i++)
		{
			if(vis[i])
			{
				if(vis[i+1]&&!flag)
				{
					ans+=(v-1)*v+1;
					flag=1;
				}
				else if(vis[i]+1==0)
				{
					ans+=v;
					flag2=1;
				}
			}
			else
			{
				if(vis[i+1]==0&&flag)
				{
					printf("%lld\n",v*v);
					continue;
				}
				else
				{
					ans+=v;
					if(flag2) {ans--;printf("%lld\n",ans);continue;}
				}
			}
			printf("%lld\n",ans);
		}
	}
	return 0;
}

