#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MX = 3001;
map<pair<int, int>, bool> forbidden[MX];
struct Graph {
  int d[MX][MX];
  int parent[MX][MX];
  vector<int> adj[MX];
  void addEdge(int u, int v) {
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  vector<int> bfs(int s, int n) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        d[i][j] = INF;
        parent[i][j] = -1;
      }
    }
    d[n][s] = 0;
    deque<pair<int, int>> q;
    q.push_back({n, s});
    while (!q.empty()) {
      int a = q.front().first;
      int b = q.front().second;
      q.pop_front();
      for (int c : adj[b]) {
        if (d[b][c] == INF && !forbidden[a][{b, c}]) {
          d[b][c] = d[a][b] + 1;
          parent[b][c] = a;
          q.push_back({b, c});
        }
      }
    }
    int minDistance = INF;
    for (int i = 0; i < n; i++) {
      minDistance = min(minDistance, d[i][n - 1]);
    }
    if (minDistance == INF) return {};
    int prev = -1;
    for (int i = 0; i < n; i++) {
      if (d[i][n - 1] == minDistance) {
        prev = i;
        break;
      }
    }
    vector<int> path = {n};
    int cur = n - 1;
    while (prev != n) {
      path.push_back(prev + 1);
      int aux = prev;
      prev = parent[prev][cur];
      cur = aux;
    }
    reverse(path.begin(), path.end());
    return path;
  }
} G;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    G.addEdge(u, v);
  }
  for (int i = 0; i < k; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    c--;
    forbidden[a][{b, c}] = true;
  }
  vector<int> path = G.bfs(0, n);
  cout << (int)path.size() - 1 << "\n";
  for (int u : path) cout << u << " ";
  cout << "\n";
  return 0;
}
