#include <bits/stdc++.h>
using namespace std;
const int Mn = 3000 + 5;
vector<int> adj[Mn];
map<pair<int, pair<long long, long long> >, bool> mp;
bool mark[Mn][Mn];
int hig[Mn][Mn], par[Mn][Mn], n;
void BFS(int x) {
  pair<long long, long long> now = make_pair(0, x);
  queue<pair<long long, long long> > q;
  q.push(now);
  mark[0][x] = 1;
  while (q.size()) {
    now = q.front();
    q.pop();
    int fi = now.first, se = now.second;
    for (auto child : adj[se])
      if (!mp[make_pair(fi, make_pair(se, child))] && !mark[se][child]) {
        hig[se][child] = hig[fi][se] + 1;
        mark[se][child] = 1;
        par[se][child] = fi;
        q.push(make_pair(se, child));
        if (child == n) {
          cout << hig[se][n] << endl;
          vector<int> vec;
          now = make_pair(se, n);
          while (now.first) {
            vec.push_back(now.second);
            now = make_pair(par[now.first][now.second], now.first);
          }
          cout << 1 << " ";
          while (!vec.empty()) {
            cout << vec.back() << " ";
            vec.pop_back();
          }
          cout << endl;
          return;
        }
      }
  }
  cout << -1 << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int m, k;
  cin >> n >> m >> k;
  while (m--) {
    int fi, se;
    cin >> fi >> se;
    adj[fi].push_back(se), adj[se].push_back(fi);
  }
  while (k--) {
    int fi, se, th;
    cin >> fi >> se >> th;
    mp[make_pair(fi, make_pair(se, th))] = 1;
  }
  BFS(1);
  return 0;
}
