unittest
{
	assert( [ "2 3 1", "1 1", "2 2", "1 2", "1 2" ].parse.expand.solve == "3" );
	assert( [ "10 3 2", "1 5", "2 8", "7 10", "1 7", "3 10" ].parse.expand.solve == "1\n1" );
	assert(
		[
			"10 10 10",
			"1 6", "2 9", "4 5", "4 7", "4 7", "5 8", "6 6", "6 7", "7 9", "10 10",
			"1 8", "1 9", "1 10", "2 8", "2 9", "2 10", "3 8", "3 9", "3 10", "1 10"
		]
		.parse.expand.solve == "7\n9\n10\n6\n8\n9\n6\n7\n8\n10"
	);
}



import std.algorithm;
import std.conv;
import std.functional;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

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

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nmq = input.front.split.to!( int[] );
	
	auto lrs = new int[ 2 ][ nmq[ 1 ] ];
	foreach( ref lr; lrs )
	{
		input.popFront;
		lr = input.front.split.to!( int[] );
	}
	
	auto pqs = new int[ 2 ][ nmq[ 2 ] ];
	foreach( ref pq; pqs )
	{
		input.popFront;
		pq = input.front.split.to!( int[] );
	}
	
	return tuple( nmq[ 0 ], lrs, pqs );
}

auto solve( in int n, in int[ 2 ][] lrs, in int[ 2 ][] pqs )
{
	string[] rs;
	size_t[] hs;
	auto lrs_sorted = sort( lrs.dup ).array;
	
	// 先頭位置のキャッシュ配列を作成
	hs = cachingHeadIndex( n, lrs_sorted );
	
	// 条件に一致する列車をカウント
	foreach( pq; pqs )
	{
		rs ~= memoize!countTrain( lrs_sorted, hs, pq ).to!( string );
	}
	
	return rs.join( "\n" );
}

auto cachingHeadIndex( in int n, in int[ 2 ][] lrs )
{
	size_t[] hs;
	int l = 0;
	
	hs.length = n + 2;
	foreach( i, lr; lrs )
	{
		if( l < lr[ 0 ] )
		{
			foreach( ref h; hs[ l + 1 .. lr[ 0 ] + 1 ] )
			{
				h = i;
			}
			l = lr[ 0 ];
		}
	}
	foreach( ref h; hs[ l + 1 .. $ ] )
	{
		h = lrs.length;
	}
	
	return hs;
}

auto countTrain( in int[ 2 ][] lrs, in size_t[] hs, in int[ 2 ] pq )
{
	auto c = 0;
	
	foreach( i; pq[ 0 ] .. pq[ 1 ] + 1 )
	{
		foreach( lr; lrs[ hs[ i ] .. hs[ i + 1 ] ] )
		{
			if( pq[ 1 ] < lr[ 1 ] ) break;
			c++;
		}
	}
	
	return c;
}
