#include <bits/stdc++.h>
using namespace std;
void input() {}
struct info {
  long long int val, parent;
};
long long int n, m, k;
vector<long long int> adj[3005];
set<tuple<long long int, long long int, long long int>> s;
map<pair<long long int, long long int>, long long int> st;
void solve() {
  cin >> n >> m >> k;
  for (long long int i = 0; i < m; i++) {
    long long int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (long long int i = 0; i < k; i++) {
    long long int a, b, c;
    cin >> a >> b >> c;
    s.insert(make_tuple(a, b, c));
  }
  info start, end;
  start.val = 1, start.parent = 0;
  end.val = n, end.parent = -1;
  st[make_pair(0, 1)] = -1;
  queue<info> q;
  q.push(start);
  while (!q.empty()) {
    info curr = q.front();
    q.pop();
    if (curr.val == end.val) {
      end.parent = curr.parent;
      break;
    }
    for (auto x : adj[curr.val]) {
      if (st.find(make_pair(curr.val, x)) == st.end() &&
          s.find(make_tuple(curr.parent, curr.val, x)) == s.end()) {
        info temp;
        temp.val = x, temp.parent = curr.val;
        q.push(temp);
        st[make_pair(curr.val, x)] = curr.parent;
      }
    }
  }
  if (end.parent == -1) {
    cout << "-1";
    return;
  }
  vector<long long int> ans;
  while (end.val != 0) {
    ans.push_back(end.val);
    info temp;
    temp.parent = st[make_pair(end.parent, end.val)];
    temp.val = end.parent;
    end = temp;
  }
  reverse(ans.begin(), ans.end());
  cout << ans.size() - 1 << "\n";
  for (auto x : ans) {
    cout << x << " ";
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  input();
  int t = 1, i = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
