#include<bits/stdc++.h>
using namespace std;

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

struct ford_fulkerson{
    static const int INF=1001001001001001001;
    static const int MAX_V=2010;
    static const int SOURCE=MAX_V-2;
    static const int SINK=MAX_V-1;

    struct edge{
        int to,cap,rev;
        edge(int to,int cap,int rev):to(to),cap(cap),rev(rev){}
    };
    vector<edge>G[MAX_V];
    bool used[MAX_V];

    void add_edge(int from,int to,int cap){
        G[from].push_back(edge(to,cap,G[to].size()));
        G[to].push_back(edge(from,0,G[from].size()-1));
    }

    int dfs(int v,int t,int f){
        if(v==t)return f;
        used[v]=true;
        for(int i=0;i<G[v].size();i++){
            edge &e=G[v][i];
            if(!used[e.to]&&e.cap>0){
                int d=dfs(e.to,t,min(f,e.cap));
                if(d>0){
                    e.cap-=d;
                    G[e.to][e.rev].cap+=d;
                    return d;
                }
            }
        }
        return 0;
    }

    int max_flow(int s=SOURCE,int t=SINK){
        int flow=0;
        for(;;){
            memset(used,0,sizeof(used));
            int f=dfs(s,t,INF);
            if(f==0)return flow;
            flow+=f;
        }
    }
};

int N,M,L;
const int INF=1001001001001001001;
int dist[100][100];
void solve(){
    fill_n(*dist,100*100,INF);
    rep(i,N)dist[i][i]=0;

    rep(i,M){
        int a,b,c;
        cin>>a>>b>>c;
        chmin(dist[a][b],c);
        chmin(dist[b][a],c);
    }
    rep(k,N)rep(i,N)rep(j,N)chmin(dist[i][j],dist[i][k]+dist[k][j]);

    vpint qs;
    rep(i,L){
        int a,b;
        cin>>a>>b;
        qs.pb(pint(b,a));
    }

    sort(all(qs));

    ford_fulkerson ff;
    for(int i=0;i<L;i++){
        for(int j=i+1;j<L;j++){
            if(dist[qs[i].se][qs[j].se]<=qs[j].fi-qs[i].fi){
                ff.add_edge(i*2+1,j*2,1);
            }
        }
    }

    for(int i=0;i<L;i++){
        ff.add_edge(ford_fulkerson::SOURCE,i*2+1,1);
        ff.add_edge(i*2,ford_fulkerson::SINK,1);
    }

    cout<<L-ff.max_flow()<<endl;
}

signed main(){
    while(cin>>N>>M>>L,N||M||L)solve();
    return 0;
}