#include <bits/stdc++.h>
const int INF = 1000000000;
const long long int MOD = 1000000007;
using namespace std;
int n, m;
vector<int> g[3001];
int dist[3001][3001];
vector<int> bad[3001][3001];
int last[3001][3001];
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  int k;
  cin >> n >> m >> k;
  for (int i = 0; i < 3001; i++) g[i].clear();
  for (int i = 0; i < m; i++) {
    int a, b, c;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  for (int i = 0; i < 3001; i++)
    for (int j = 0; j < 3001; j++) dist[i][j] = INF;
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    bad[b][a].push_back(c);
  }
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < n + 1; j++) sort(bad[i][j].begin(), bad[i][j].end());
  }
  queue<pair<pair<int, pair<int, int> >, int> > pq;
  pq.push(make_pair(make_pair(0, make_pair(1, 0)), 0));
  pair<pair<int, pair<int, int> >, int> curr;
  while (!pq.empty()) {
    curr = pq.front();
    pq.pop();
    if (dist[curr.first.second.first][curr.first.second.second] <=
        curr.first.first)
      continue;
    dist[curr.first.second.first][curr.first.second.second] = curr.first.first;
    last[curr.first.second.first][curr.first.second.second] = curr.second;
    if (curr.first.second.first == n) break;
    for (int i = 0; i < g[curr.first.second.first].size(); i++) {
      if (binary_search(
              bad[curr.first.second.first][curr.first.second.second].begin(),
              bad[curr.first.second.first][curr.first.second.second].end(),
              g[curr.first.second.first][i])) {
        continue;
      }
      pq.push(make_pair(make_pair(curr.first.first + 1,
                                  make_pair(g[curr.first.second.first][i],
                                            curr.first.second.first)),
                        curr.first.second.second));
    }
  }
  for (int i = 0; i < n + 1; i++) {
    for (int j = 0; j < n + 1; j++) {
    }
  }
  int mn = INF;
  pair<int, int> lt = make_pair(-1, -1);
  for (int i = 0; i < n + 1; i++) {
    if (mn > dist[n][i]) {
      mn = dist[n][i];
      lt = make_pair(n, i);
    }
  }
  if (mn == INF)
    cout << -1 << endl;
  else {
    cout << mn << endl;
    stack<int> st;
    while (lt.second != 0) {
      st.push(lt.first);
      lt = make_pair(lt.second, last[lt.first][lt.second]);
    }
    st.push(1);
    while (!st.empty()) {
      cout << st.top() << " ";
      st.pop();
    }
    cout << endl;
  }
}
