#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <unordered_set>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using i64 = long long;
template<class T, class U>
bool chmin(T& a, const U& b) { return (b < a) ? (a = b, true) : false; }
template<class T, class U>
bool chmax(T& a, const U& b) { return (b > a) ? (a = b, true) : false; }

template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(vector<T>&v){stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v){if(v.size())o<<join(v);return o;}
template<typename T>string join(vector<vector<T>>&vv){string s="\n";rep(i,vv.size())s+=join(vv[i])+"\n";return s;}
template<typename T>ostream& operator<<(ostream&o,vector<vector<T>>&vv){if(vv.size())o<<join(vv);return o;}

int n;

vector<int> edge[200010];

int bfs(int st)
{
    vector<int> visited(n, -1);
    queue<int> que;
    que.push(st);
    visited[st] = 0;
    while (!que.empty())
    {
        auto now = que.front();
        que.pop();
        for (auto e: edge[now])
        {
            if (visited[e] != -1) continue;
            visited[e] = visited[now] + 1;
            que.push(e);
        }
    }
    auto m = *max_element(all(visited));
    rep(i, n) if (visited[i] == m) return i;
    return -1;
}

map<int, int> mp;

bool dfs(int st, int gl, int p)
{
    if (st == gl) return true;
    for (auto e: edge[st])
    {
        if (e == p) continue;
        if (dfs(e, gl, st))
        {
            mp[st] = e;
            return true;
        }
    }
    return false;
}

int ans[200010];
int c = 1;

void dfs2(int now, int p)
{
    ans[now] = c++;
    for (auto e: edge[now])
    {
        if (e == p) continue;
        if (e == mp[now]) continue;
        dfs2(e, now);
        c++;
    }
    if (mp[now] != -1) dfs2(mp[now], now);
}

int main()
{
    cin >> n;
    rep(i, n - 1)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    rep(i, n) mp[i] = -1;
    auto s = bfs(0);
    auto g = bfs(s);
    dfs(s, g, -1);
    dfs2(s, -1);
    rep(i, n) cout << ans[i] << " ";
}
#include <bits/stdc++.h>
#include <unordered_set>
#include <cmath>

// URL: https://atcoder.jp/contests/abc195/tasks/abc195_d

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = (int)(s); i < (int)(n); i++)

#define repll(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repsll(i, s, n) for (ll i = (ll)(s); i < (ll)(n); i++)

#define ALL(a) (a).begin(), (a).end()

#define pb push_back
#define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

const ll INFL = 1e18;
const int INF = 1e9;



int main(){
  optimize_cin();

  ll N, M, Q;
  cin >> N >> M >> Q;

  //vector<pll> WV(N);
  //vll W(N), V(N);
  vector<pll> VW(N);
  vll X(M), L(Q), R(Q);

  rep(i, N){
  ll W, V;
  // cin >> W[i] >> V[i];
  cin >> W >> V;
  VW[i] = make_pair(V, W);
  // WV[i].first() = W;
  // WV[i].second() = V;
  } 
  rep(i, M) cin >> X[i];
  rep(i, Q) cin >> L[i] >> R[i];

  sort(ALL(VW));
  reverse(ALL(VW));

  // ll max = 0;

  rep(i, Q) {
  vector<bool> box(M, true);
  for(int j = L[i] - 1; j <= R[i] - 1; j++){
  box[j] = false;
  }
  vll avail;
  rep(j, M){
  if(box[j]){
  avail.pb(X[j]);
  }
  }
  sort(ALL(avail));
  // reverse(ALL(avail));
  vll used(avail.size(), false);
  int cnt = avail.size();
  ll max = 0;
  rep(j, N)
  {
  rep(k, avail.size()){
  if(cnt > 0 && !used[k] && VW[j].second <= avail[k]){
  max += VW[j].first; 
  used[k] = true;
  cnt--;
  break;
  }
  }
  }
  cout << max << endl;

}




  return 0;
}