#include <bits/stdc++.h>
using namespace std;
int dp[3005][3005];
int ans[3005][3005];
int par[3005][3005];
map<pair<int, int>, int> mp[3005];
vector<int> v;
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= (int)m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    dp[a][b] = 1;
    dp[b][a] = 1;
  }
  for (int i = 1; i <= (int)k; i++) {
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    mp[a][{b, c}] = 1;
  }
  for (int i = 1; i < 3005; i++)
    for (int j = 1; j < 3005; j++) ans[i][j] = 1000000007;
  ans[1][1] = 0;
  par[1][1] = 0;
  priority_queue<pair<int, int>, vector<pair<int, int> >,
                 greater<pair<int, int> > >
      q;
  q.push({1, 1});
  while (!q.empty()) {
    pair<int, int> p = q.top();
    q.pop();
    int x = p.first;
    int y = p.second;
    for (int i = 1; i <= n; i++) {
      if (dp[y][i] && mp[x].find({y, i}) == mp[x].end()) {
        if (ans[y][i] > ans[x][y] + dp[y][i]) {
          ans[y][i] = ans[x][y] + dp[y][i];
          par[y][i] = x;
          q.push({y, i});
        }
      }
    }
  }
  int ans1 = 1000000007;
  pair<int, int> p;
  for (int i = 1; i <= n; i++) {
    if (ans1 > ans[i][n]) {
      ans1 = ans[i][n];
      p = {i, n};
    }
  }
  if (ans1 == 1000000007) {
    printf("-1");
    return 0;
  }
  printf("%d\n", ans1);
  v.push_back(n);
  while (p.first != 0 && p.second != 1) {
    v.push_back(p.first);
    int pp = par[p.first][p.second];
    swap(p.first, p.second);
    p.first = pp;
  }
  reverse(v.begin(), v.end());
  for (auto k : v) printf("%d ", k);
  return 0;
}
