#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3001;
int n, m, k, x, y, z, dp[MAXN][MAXN];
map<pair<int, int>, int> pre;
vector<int> adj[MAXN];
vector<int> check[MAXN][MAXN];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> m >> k;
  for (int i = 1; i <= m; ++i) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 1; i <= k; ++i) {
    cin >> x >> y >> z;
    check[x][y].push_back(z);
  }
  queue<pair<int, pair<int, int> > > q;
  dp[1][1] = 0;
  q.push({0, {1, 1}});
  while (!q.empty()) {
    int w = q.front().first, u = q.front().second.first,
        v = q.front().second.second;
    q.pop();
    for (int i = 0; i <= int(adj[v].size()) - 1; ++i) {
      int s = adj[v][i];
      if (find(check[u][v].begin(), check[u][v].end(), s) ==
          check[u][v].end()) {
        if (dp[v][s] > dp[u][v] + 1 || dp[v][s] == 0) {
          dp[v][s] = dp[u][v] + 1;
          q.push({dp[v][s], {v, s}});
          pre[{v, s}] = u;
        }
      }
    }
  }
  int MIN = INT_MAX, mini;
  for (int i = 1; i <= n - 1; ++i) {
    if (MIN > dp[i][n] && dp[i][n] != 0) {
      MIN = dp[i][n];
      mini = i;
    }
  }
  if (MIN == INT_MAX) {
    cout << -1 << endl;
    return 0;
  } else {
    cout << MIN << endl;
  }
  int now = n;
  vector<int> ans;
  ans.push_back(now);
  if (mini != 1) ans.push_back(mini);
  while (pre[{mini, now}] != 1) {
    ans.push_back(pre[{mini, now}]);
    int tmp = mini;
    mini = pre[{tmp, now}];
    now = tmp;
  }
  cout << 1 << " ";
  for (int i = int(ans.size()) - 1; i >= 0; --i) {
    cout << ans[i] << " ";
  }
}
