#include <bits/stdc++.h>
using namespace std;
struct three {
  int fr;
  int se;
  int th;
};
const int MAXN = 5001;
set<three> lsd;
vector<int> edge[MAXN];
pair<int, int> was[MAXN];
bool wss[MAXN][MAXN];
int i, j, n, m, k, a, b, c;
vector<int> ans;
int lst[MAXN][MAXN];
pair<int, int> null_pair;
struct order {
  int last;
  int v;
  int type;
};
bool operator<(three a, three b) {
  if (a.fr != b.fr) {
    return a.fr < b.fr;
  } else {
    if (a.se != b.se) {
      return a.se < b.se;
    } else {
      return a.th < b.th;
    }
  }
}
inline three make_three(int a, int b, int c) {
  three t;
  t.fr = a;
  t.se = b;
  t.th = c;
  return t;
}
inline bool can(order t, int v) {
  if (lsd.find(make_three(t.last, t.v, v)) != lsd.end()) {
    return false;
  }
  return true;
}
void dfs(int a, int b) {
  if (lst[a][b] > -1) {
    ans.push_back(b);
    dfs(lst[a][b], a);
  }
}
void bfs(int v) {
  int i, j;
  order t, tt;
  t.last = 0;
  t.v = v;
  queue<order> q;
  q.push(t);
  was[v] = make_pair(-1, 0);
  lst[0][1] = -1;
  while (!q.empty()) {
    t = q.front();
    q.pop();
    for (i = 0; i < edge[t.v].size(); ++i) {
      if (!(wss[t.v][edge[t.v][i]])) {
        if (can(t, edge[t.v][i])) {
          was[edge[t.v][i]] = make_pair(t.v, 0);
          tt.last = t.v;
          tt.v = edge[t.v][i];
          q.push(tt);
          wss[t.v][edge[t.v][i]] = 1;
          lst[t.v][edge[t.v][i]] = t.last;
          if (edge[t.v][i] == n) {
            dfs(t.v, edge[t.v][i]);
            return;
          }
        }
      }
    }
  }
}
int main() {
  cin >> n >> m >> k;
  for (i = 0; i < m; ++i) {
    cin >> a >> b;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for (i = 0; i < k; ++i) {
    cin >> a >> b >> c;
    lsd.insert(make_three(a, b, c));
  }
  bfs(1);
  if (ans.size() > 0) {
    reverse(ans.begin(), ans.end());
    cout << ans.size() << "\n1 ";
    for (i = 0; i < ans.size(); ++i) {
      cout << ans[i] << " ";
    }
  } else {
    cout << "-1";
  }
  return 0;
}
