#include <bits/stdc++.h>
using namespace std;
struct vertex {
  int value, f, d;
  char color;
};
vertex v[6666];
int a[6666][6666];
int p[6666];
int flag[6666];
int n, m, k;
void BFS(int s) {
  int i;
  for (i = 0; i <= 2 * n; i++) {
    v[i].color = 'w';
    v[i].d = 99999;
    p[i] = -1;
  }
  v[s].color = 'g';
  v[s].d = 0;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (i = 0; i < 2 * n; i++) {
      if (u != i && a[u][i] == 1 && v[i].color == 'w') {
        v[i].color = 'g';
        v[i].d = v[u].d + 1;
        p[i] = u;
        q.push(i);
      }
    }
    v[u].color = 'b';
  }
}
void print(int i) {
  if (p[i] == -1)
    cout << i % n + 1;
  else {
    print(p[i]);
    cout << " " << i % n + 1;
  }
}
int main() {
  cin >> n >> m >> k;
  int i, j;
  for (i = 0; i < 2 * n; i++) {
    flag[i / 2] = 1;
    for (j = 0; j < 2 * n; j++) a[i][j] = 0;
  }
  int x, y, z;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    a[x - 1][y - 1] = 1;
    a[y - 1][x - 1] = 1;
    a[y - 1 + n][x - 1] = 1;
  }
  for (i = 0; i < k; i++) {
    cin >> x >> y >> z;
    if (flag[x - 1] == 1) {
      a[x - 1][y - 1 + n] = a[x - 1][y - 1];
      a[x - 1][y - 1] = 0;
      a[y + n - 1][z - 1] = 0;
      a[y + n - 1][z + n - 1] = 0;
      flag[y - 1] = 2;
    } else if (flag[x - 1] == 2) {
      a[x + n - 1][y + n - 1] = a[x + n - 1][y - 1];
      a[x + n - 1][y - 1] = 0;
      a[y + n - 1][z - 1] = 0;
      a[y + n - 1][z + n - 1] = 0;
      flag[y - 1] = 2;
    }
  }
  BFS(0);
  if (p[n - 1] == -1 && p[2 * n - 1] == -1)
    cout << "-1" << endl;
  else {
    if (v[n - 1].d < v[2 * n - 1].d) {
      cout << v[n - 1].d << endl;
      print(n - 1);
      cout << endl;
    } else {
      cout << v[2 * n - 1].d << endl;
      print(2 * n - 1);
      cout << endl;
    }
  }
  return 0;
}
