#include <bits/stdc++.h>
using namespace std;
int n, x, y;
int parent[3003][3003], vis[3003][3003];
vector<vector<int>> v(3003, vector<int>());
set<pair<int, pair<int, int>>> s;
struct node {
  int p, x, c;
};
void fun() {
  node cur, nw;
  queue<node> q;
  cur.x = 1, cur.p = 1;
  q.push(cur);
  int ans = 1e+9;
  y = n, vis[1][1] = 0;
  while (q.size()) {
    cur = q.front();
    q.pop();
    for (int i = 0; i < v[cur.x].size(); i++) {
      if (s.find(make_pair(cur.p, make_pair(cur.x, v[cur.x][i]))) != s.end() ||
          vis[cur.x][v[cur.x][i]] != -1)
        continue;
      vis[cur.x][v[cur.x][i]] = vis[cur.p][cur.x] + 1;
      parent[cur.x][v[cur.x][i]] = cur.p;
      if (v[cur.x][i] == n) {
        if (ans > vis[cur.x][v[cur.x][i]]) {
          ans = vis[cur.x][v[cur.x][i]];
          x = cur.x;
        }
        continue;
      }
      nw.x = v[cur.x][i], nw.p = cur.x;
      q.push(nw);
    }
  }
  if (ans == 1e+9) {
    cout << -1 << endl;
    return;
  }
  cout << ans << endl;
  vector<int> a;
  int tmp;
  a.push_back(y);
  while (1) {
    a.push_back(x);
    if (x == 1) break;
    tmp = x;
    x = parent[x][y];
    y = tmp;
  }
  for (int i = a.size() - 1; i >= 0; i--) cout << a[i] << " ";
  cout << endl;
}
int main() {
  memset(vis, -1, sizeof vis);
  int m, k;
  cin >> n >> m >> k;
  while (m--) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  int z;
  while (k--) {
    cin >> x >> y >> z;
    s.insert(make_pair(x, make_pair(y, z)));
  }
  fun();
}
