unittest
{
	assert( [ "4 4 1", "2 1", "1 3", "3 2", "3 4", "4 1" ].parse.expand.solve == "0 1 0 1" );
	assert( [ "5 10 0", "1 2", "1 3", "1 4", "1 5", "3 2", "2 4", "2 5", "4 3", "5 3", "4 5" ].parse.expand.solve == "0 0 0 0 0" );
	assert( [ "10 9 3", "10 1", "6 7", "8 2", "2 5", "8 4", "7 3", "10 9", "6 4", "5 8", "2 6", "7 5", "3 1" ].parse.expand.solve == "1 3 5 4 3 3 3 3 1 0" );
}



import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nmk = input.front.split.to!( long[] );
	auto abs = new long[ 2 ][ nmk[ 1 ] ];
	foreach( ref ab; abs )
	{
		input.popFront;
		ab = input.front.split.to!( long[] );
		ab[] -= 1;
	}
	auto cds = new long[ 2 ][ nmk[ 2 ] ];
	foreach( ref cd; cds )
	{
		input.popFront;
		cd = input.front.split.to!( long[] );
		cd[] -= 1;
	}
	return tuple( nmk[ 0 ], abs, cds );
}

auto solve( long n, long[ 2 ][] abs, long[ 2 ][] cds )
{
	auto fss = new byte[][]( n, n );
	foreach( ab; abs )
	{
		fss[ ab[ 0 ] ][ ab[ 1 ] ] = 1;
		fss[ ab[ 1 ] ][ ab[ 0 ] ] = 1;
	}
	foreach( cd; cds )
	{
		fss[ cd[ 0 ] ][ cd[ 1 ] ] = -1;
		fss[ cd[ 1 ] ][ cd[ 0 ] ] = -1;
	}
	auto uft = UnionFindTree( n );
	foreach( ab; abs )
	{
		uft.unite( ab[ 0 ], ab[ 1 ] );
	}
	
	auto anss = new long[ n ];
	foreach( i; 0L .. n )
	{
		foreach( j; i + 1 .. n )
		{
			if( fss[ i ][ j ] == 0 && uft.same( i, j ) )
			{
				anss[ i ]++;
				anss[ j ]++;
			}
		}
	}
	return anss.to!( string[] ).join( " " );
}

// UnionFind木
struct UnionFindTree
{
	long[] ps;
	long[] rs;
	
	this( long n )
	{
		ps.length = n;
		ps[] = -1;
		rs.length = n;
	}
	
	long root( long i )
	{
		if( ps[ i ] < 0 ) return i;
		else              return ps[ i ] = root( ps[ i ] );
	}
	
	auto same( long i, long j )
	{
		return root( i ) == root( j );
	}
	
	void unite( long i, long j )
	{
		i = root( i );
		j = root( j );
		if( i == j ) return;
		if( rs[ i ] < rs[ j ] )
		{
			ps[ j ] += ps[ i ];
			ps[ i ] = j;
		}
		else
		{
			ps[ i ] += ps[ j ];
			ps[ j ] = i;
			if( rs[ i ] == rs[ j ] ) rs[ i ]++;
		}
	}
}
