#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
template <class T>
bool chmax(T &a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
bool chmin(T &a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

constexpr int INF = 1e9;

struct Dinic {
    struct edge { int to, cap, rev; };
    int V;
    vector<vector<edge>> G;
    vector<int> itr, level;

    Dinic(int V) : V(V) { G.assign(V, vector<edge>()); }

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

    void bfs(int s) {
        level.assign(V, -1);
        queue<int> q;
        level[s] = 0;
        q.push(s);
        while (q.size()) {
            int v = q.front(); q.pop();
            for  (auto &e : G[v]) {
                if (e.cap > 0 && level[e.to] < 0) {
                    level[e.to] = level[v] + 1;
                    q.push(e.to);
                }
            }
        }
    }

    int dfs(int v, int t, int f) {
        if (v == t) return f;
        for (int &i = itr[v]; i < G[v].size(); i++) {
            edge &e = G[v][i];
            if (e.cap > 0 && level[v] < level[e.to]) {
                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, int t) {
        int ret = 0, f;
        while (bfs(s), level[t] >= 0) {
            itr.assign(V, 0);
            while ((f = dfs(s, t, INF)) > 0) ret += f;
        }
        return ret;
    }
};

signed main() {
    int N, M, L;
    while (1) {
        cin >> N >> M >> L;
        if (N == 0) break;

        vector<vector<int>> adj(N, vector<int>(N, INF));
        rep(i, 0, N) {
            adj[i][i] = 1;
        }
        rep(i, 0, M) {
            int a, b, c;
            cin >> a >> b >> c;
            adj[a][b] = adj[b][a] = c;
        }
        rep(k, 0, N) {
            rep(i, 0, N) {
                rep(j, 0, N) {
                    chmin(adj[i][j], adj[i][k] + adj[k][j]);
                }
            }
        }
        vector<vector<int>> req_time(N), node_id(N);
        rep(i, 0, L) {
            int p, t;
            cin >> p >> t;
            req_time[p].push_back(t);
        }
        rep(i, 0, N) sort(req_time[i].begin(), req_time[i].end());
        int idx = 0;
        rep(i, 0, N) for (auto t : req_time[i]) {
            node_id[i].push_back(idx);
            idx++;
        }

        int SZ = idx;
        vector<vector<int>> dag(SZ);
        rep(i, 0, N) {
            rep(k, 0, req_time[i].size()) {
                int T = req_time[i][k];
                int nd = node_id[i][k];
                rep(j, 0, N) {
                    if (adj[i][j] != INF) {
                        int nxt = T + adj[i][j];
                        auto itr = lower_bound(req_time[j].begin(), req_time[j].end(), nxt);
                        if (itr == req_time[j].end()) continue;
                        int p = itr - req_time[j].begin();
                        int nx_nd = node_id[j][p];
                        dag[nd].push_back(nx_nd);
                    }
                }
            }
        }

        Dinic bimatch(SZ * 2 + 2); // 0: S, 1:S
        rep(v, 0, SZ) {
            bimatch.add_edge(0, 2 + v, 1);
            bimatch.add_edge(2 + SZ + v, 1, 1);
        }
        rep(v, 0, SZ) {
            for (int w : dag[v]) {
                bimatch.add_edge(2 + v, 2 + SZ + w, 1);
            }
        }
        int min_path_cover = SZ - bimatch.max_flow(0, 1);
        cout << min_path_cover << endl;
    }
    return 0;
}


Measured memory_bytes: 9128