#include <bits/stdc++.h>
using namespace std;
int T, n, m, k;
int d[6666];
int flag[6666];
int pi[6666];
int adj[6666][6666];
queue<int> q;
vector<int> vec;
void init() {
  int i, j;
  vec.clear();
  for (i = 0; i < 6666; i++) {
    pi[i] = -1;
    d[i] = 0x7fffffff;
    flag[i] = 0;
    for (j = 0; j < 6666; j++) {
      adj[i][j] = 0x7fffffff;
    }
  }
}
void SPFA() {
  int u, v;
  q.push(1);
  d[1] = 0;
  while (!q.empty()) {
    u = q.front();
    q.pop();
    for (v = 1; v <= 2 * n; v++) {
      if (d[v] == 0x7fffffff && adj[u][v] == 1) {
        pi[v] = u;
        d[v] = d[u] + adj[u][v];
        q.push(v);
      }
    }
  }
}
void print(int a[][2 * 6666]) {
  int i, j, _n = 2 * n;
  ;
  cout << "\t";
  for (i = 1; i <= _n; i++) cout << i << "\t";
  cout << endl;
  for (i = 1; i <= _n; i++) {
    cout << i << "\t";
    for (j = 1; j <= _n; j++) {
      cout << a[i][j] << "\t";
    }
    cout << endl;
  }
  cout << endl;
}
int main() {
  int i, a, b, c;
  while (cin >> n >> m >> k) {
    init();
    for (i = 0; i < m; i++) {
      cin >> a >> b;
      adj[a][b] = adj[b][a] = 1;
      adj[a + n][b] = adj[b + n][a] = 1;
    }
    for (i = 0; i < k; i++) {
      cin >> a >> b >> c;
      if (flag[a] == 0) {
        adj[a][b + n] = adj[a][b];
        adj[a][b] = 0x7fffffff;
        adj[b + n][c] = 0x7fffffff;
        adj[b + n][c + n] = 0x7fffffff;
        flag[b] = 1;
      } else {
        adj[a + n][b + n] = adj[a + n][b];
        adj[a + n][b] = 0x7fffffff;
        adj[b + n][c] = 0x7fffffff;
        adj[b + n][c + n] = 0x7fffffff;
        flag[b] = 1;
      }
    }
    SPFA();
    if (d[n] != 0x7fffffff || d[2 * n] != 0x7fffffff) {
      int len, t;
      if (d[n] != 0x7fffffff)
        t = n;
      else
        t = 2 * n;
      while (t != -1) {
        vec.push_back(t);
        t = pi[t];
      }
      cout << d[n] << endl;
      len = vec.size();
      for (i = len - 1; i > 0; i--) {
        if (vec[i] <= n)
          cout << vec[i] << " ";
        else
          cout << vec[i] - n << " ";
      }
      if (vec[i] <= n)
        cout << vec[i] << endl;
      else
        cout << vec[i] - n << endl;
    } else
      cout << -1 << endl;
  }
  return 0;
}
