#include <bits/stdc++.h>
using namespace std;
map<pair<int, pair<int, int> >, bool> check;
int n, m, k;
vector<int> g[3100];
bool visited[3100][3100];
int dist[3100][3100];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> k;
  int u, v, d;
  for (int i = 0; i < m; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 0; i < k; i++) {
    cin >> u >> v >> d;
    check[make_pair(u, make_pair(v, d))] = true;
  }
  queue<pair<int, int> > q;
  visited[1][0] = true;
  q.push(make_pair(1, 0));
  while (!q.empty()) {
    pair<int, int> curr = q.front();
    q.pop();
    for (int i : g[curr.first]) {
      if (!visited[i][curr.first] &&
          !check[make_pair(curr.second, make_pair(curr.first, i))]) {
        visited[i][curr.first] = true;
        dist[i][curr.first] = dist[curr.first][curr.second] + 1;
        q.push(make_pair(i, curr.first));
      }
    }
  }
  int x = INT_MAX, index = 0;
  for (int i = 0; i < n; i++) {
    if (dist[n][i] != 0 && dist[n][i] < x) {
      x = dist[n][i];
      index = i;
    }
  }
  if (x == INT_MAX) {
    cout << -1;
    return 0;
  }
  cout << x << "\n";
  vector<int> path;
  int xx = x;
  int curr = n;
  for (int i = 0; i <= xx; i++) {
    path.push_back(curr);
    int next_curr = 0;
    for (int j = 0; j <= n; j++) {
      if (dist[curr][j] == x) {
        next_curr = j;
      }
    }
    curr = next_curr;
    x--;
  }
  reverse(path.begin(), path.end());
  for (int i : path) {
    cout << i << " ";
  }
  return 0;
}
