#include<iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<sstream>
//#include<ctype.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;

const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int maxn = 1e4+5;
const ll mod = 1e9+7;

int n, m, k;
vector<int> G[maxn];
int match[maxn];		//匹配 
bool used[maxn];
int mp[maxn][maxn];
vector<Pii> q;

//?算任意?点?的最短距? 
void floyd(){
    for(int l = 0; l < n;l++){
        for(int i = 0;i < n;i++){
            for(int j = 0;j < n;j++)
                mp[i][j] = min(mp[i][j], mp[i][l] + mp[l][j]);
        }
    }
}


void addedge(int u, int v){
	G[u].push_back(v);
	G[v].push_back(u);
}

//dfs?找?广路 
bool dfs(int v){
	used[v] = true;
	for(int i=0; i<G[v].size(); i++){
		int u = G[v][i], w = match[u];
		if(w<0 || !used[w] && dfs(w)){	//u未匹配?，或?有?广路 
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

//求解二分?的最大匹配 
int bipartite_matching(){
	int res = 0;
	memset(match, -1, sizeof(match));
	for(int v = 0; v<n+k; v++){
		if(match[v] < 0){
			memset(used, 0, sizeof(used));
			if(dfs(v)){
				res++;
			}
		}
	} 
	return res;
}

//建?，到?一点后?能到?的点?? 
void build(){
    for(int i = 0;i < q.size();i++){
        for(int j = 0; j < q.size(); j++){
            if(i == j) continue;
            Pii a = q[i], b = q[j];
            int tmp = b.second - a.second;
            if(tmp >= mp[a.first][b.first]){
            	addedge(i, j+k);
            }
        }
    }
}


int main(){
	while(scanf("%d%d%d", &n, &m, &k) == 3 &&(n||k||m)){
		q.clear();
		for(int i = 0;i < 2*n;i++){
	        for(int j = 0;j < 2*n;j++){
	            if(i == j) mp[i][j] = 0;
	            else mp[i][j] = inf;
	        }
    	}
    	
		for(int i=0; i<n+k; i++){
			G[i].clear();
		}
		 
		for(int i = 0;i < m;i++){
            int u, v, w;
            scanf("%d%d%d",&u,&v,&w);
            mp[u][v] = w;
            mp[v][u] = w;
        }
        
        for(int i = 0;i < k;i++){
            int a,b;
            scanf("%d%d",&a,&b);
            q.push_back(make_pair(a,b));
        }
        
        floyd();
		build();
		
		printf("%d\n", k-bipartite_matching());
	}
	return 0;
} 