require 'set'

def warshall_floyd(dist_matrix)
	dist = dist_matrix
	n = dist.size

	next_dist = (1..n).map{ Array.new(n) }	
	(0..n-1).each{|k|
		dist_k = dist[k]
		(0..n-1).each{|i|
			dist_i = dist[i]
			next_dist_i = next_dist[i]
			(0..n-1).each{|j|
				x = dist_i[j]
				y = dist_i[k] + dist_k[j]
				next_dist_i[j] = (x < y ? x : y)
			}
		}
		dist = next_dist
	}
	dist
end

loop do
	n, m, l = gets.split.map(&:to_i)
	break if n == 0
	dist_mat = (1..n).map { [Float::INFINITY] * n }
	(0..n-1).each {|i| dist_mat[i][i] = 0}
	m.times do
		u, v, d = gets.split.map(&:to_i)
		dist_mat[u][v] = d
		dist_mat[v][u] = d
	end
	dist = warshall_floyd(dist_mat)
	
	requests = (1..l).map { gets.split.map(&:to_i) }
	requests.sort_by!(&:last)
	
	#path cover in DAG
	initial_matchings = []
	g = {}
	(0..l-1).each { |i| g[i] = Set.new }
	(0..l-1).to_a.combination(2) do |i, j|
		u, t1 = requests[i]
		v, t2 = requests[j]
		if dist[u][v] <= t2 - t1
			g[i] << j
		end
	end	
	
	until g.empty?
		u = g.keys[0]
		reached = Set[u]
		path = [u]	
		loop do
			ok = false
			g[u].each do |v|
				if ! reached.include?(v)
					ok = true
					u = v
					reached << u
					path << u
					break
				end
			end
			break unless ok
		end
		
		path.each do |u|
			g.each do |v, neighbour|
				neighbour.delete(u)
			end
			g.delete(u)
		end
		initial_matchings += path.each_cons(2).to_a
	end
	
	# p initial_matchings.size

	g = {}
	(-1..2*l).each { |i| g[i] = Set.new }
	(0..l-1).each { |i| g[-1] << i }
	(l..2*l-1).each { |i| g[i] << 2*l }

	(0..l-1).to_a.combination(2) do |i, j|
		u, t1 = requests[i]
		v, t2 = requests[j]
		if dist[u][v] <= t2 - t1
			g[i] << l + j
		end
	end	

	initial_matchings.each do |i, j|
		g[-1].delete(i)
		g[i] << -1
		g[i].delete(l+j)
		g[l+j] << i
		g[l+j].delete(2*l)
		g[2*l] << l+j
	end

	matching = initial_matchings.size
	loop do
		prev = {-1 => -2}
		stack = [-1]
		until stack.empty?
			u = stack.pop
			g[u].each do |v|
				next if prev[v]
				prev[v] = u
				stack << v
			end
		end
		break if ! prev[2*l]
		matching += 1
		path = [2*l]
		path << prev[path[-1]] until prev[path[-1]] == -2
		path.each_cons(2) do |v, u|
			g[u].delete(v)
			g[v] << u
		end
	end
	p l - matching
end