#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
int power(long long x, long long n, const long long P) {
  if (x == 0) return 0;
  if (n == 0 || x == 1) return 1LL;
  x %= P;
  int res = 1;
  while (n > 0) {
    if (n & 1) res = (long long int)res * x % P;
    x = (long long int)x * x % P;
    n /= 2;
  }
  return res;
}
long long int power(long long int x, long long int n) {
  if (x == 0)
    return 0;
  else if (n == 0 || x == 1)
    return 1;
  long long res = 1;
  while (n > 0) {
    if (n & 1) res *= x;
    x *= x;
    n /= 2;
  }
  return res;
}
int inv(long long x) { return power(x, 1000000007 - 2, 1000000007); }
long long int gcd(const long long int a, const long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long int lcm(const long long int a, const long long int b) {
  return (a * b) / gcd(a, b);
}
pair<int, int> dx[4] = {make_pair(-1, 0), make_pair(1, 0), make_pair(0, -1),
                        make_pair(0, 1)};
class Graph {
 private:
  vector<vector<int>> g;
  int n, m;

 public:
  Graph() { this->m = 0; }
  ~Graph() {}
  Graph(int n) {
    this->n = n;
    this->m = 0;
    g.clear();
    g.resize(n + 2);
  }
  void init(int n) {
    this->n = n;
    this->m = 0;
    g.clear();
    g.resize(n + 2);
  }
  void addEdge(int u, int v, bool bidir = true) {
    g[u].emplace_back(v);
    if (bidir) g[v].emplace_back(u);
    m += 1;
  }
  void addEdge(int edge, bool bidir = true) {
    for (int i = 0; i < edge; i++) {
      int u, v;
      cin >> u >> v;
      addEdge(u, v, bidir);
    }
  }
  map<pair<int, int>, set<int>> avoid;
  void addTriplets(int k) {
    for (int i = 0; i < k; i++) {
      int x, y, z;
      cin >> x >> y >> z;
      avoid[{x, y}].insert(z);
    }
  }
  void solve() {
    int dis[n + 2][n + 2];
    for (int i = 0; i < n + 2; i++)
      for (int j = 0; j < n + 2; j++) dis[i][j] = INT_MAX;
    vector<int> from(n + 2, -1);
    priority_queue<pair<int, pair<int, int>>, vector<pair<int, pair<int, int>>>,
                   greater<pair<int, pair<int, int>>>>
        q;
    dis[1][1] = 0;
    for (auto &i : g[1]) {
      if (dis[1][i] == INT_MAX) {
        dis[1][i] = 1;
        from[i] = 1;
        q.push({1, {1, i}});
      }
    }
    while (!q.empty()) {
      pair<int, pair<int, int>> p = q.top();
      q.pop();
      int x = p.second.first, y = p.second.second;
      int d = p.first;
      for (auto &i : g[y]) {
        if (avoid.count({x, y})) {
          if (avoid[{x, y}].find(i) == avoid[{x, y}].end()) {
            if (dis[y][i] > d + 1 && i != y) {
              dis[y][i] = d + 1;
              from[i] = y;
              q.push({dis[y][i], {y, i}});
            }
          }
        } else if (dis[y][i] > d + 1 && i != y) {
          dis[y][i] = d + 1;
          from[i] = y;
          q.push({dis[y][i], {y, i}});
        }
      }
    }
    int ans = INT_MAX;
    for (int i = 1; i <= n; i++) {
      if (i != n) ans = min(ans, dis[i][n]);
    }
    cout << (ans == INT_MAX ? -1 : ans) << "\n";
    if (ans != INT_MAX) {
      int last = n;
      int tot = 0;
      vector<int> res = {n};
      while (true) {
        for (int i = 1; i <= n; i++) {
          if (i != last) {
            if (ans == dis[i][last]) {
              res.emplace_back(i);
              last = i;
              ans--;
              break;
            }
          }
        }
        if (last == 1) {
          break;
        }
      }
      reverse(res.begin(), res.end());
      for (auto &i : res) cout << i << " ";
    }
  }
};
void __sol() {
  int n, m, k;
  cin >> n >> m >> k;
  Graph g;
  g.init(n);
  g.addEdge(m);
  g.addTriplets(k);
  g.solve();
  return;
}
int main() {
  clock_t time_req = clock();
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int tc = 1;
  while (tc--) __sol();
  time_req = clock() - time_req;
  return 0;
}
