#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
template <typename T>
T gcd(T a, T b) {
  while (b) {
    T t = a % b;
    a = b;
    b = t;
  }
  return a;
}
template <typename T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <typename T>
T gcd(T a, T b, T c) {
  return gcd(gcd(a, b), c);
}
template <typename T>
bool isPrime(T x) {
  if (x <= 4 || x % 2 == 0 || x % 3 == 0) return x == 2 || x == 3;
  for (T i = 5; i * i <= x; i += 6)
    if (x % i == 0 || x % (i + 2) == 0) return 0;
  return 1;
}
template <typename T>
bool bitcheck(T p, T pos) {
  return (bool)(p & (1 << pos));
}
template <typename T>
T biton(T p, T pos) {
  return p = p | (1 << pos);
}
template <typename T>
T bitoff(T p, T pos) {
  return p = p & ~(1 << pos);
}
template <typename T>
long long int toint(T s) {
  long long int p;
  stringstream ss(s);
  ss >> p;
  return p;
}
template <typename T>
string tostring(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <typename T>
T POW(T b, T p) {
  T Ans = 1;
  while (p) {
    if (p & 1) Ans = (Ans * b);
    b = (b * b);
    p >>= 1;
  }
  return Ans;
}
template <typename T>
T BigMod(T b, T p, T Mod) {
  T Ans = 1;
  while (p) {
    if (p & 1) Ans = (Ans * b) % Mod;
    b = (b * b) % Mod;
    p >>= 1;
  }
  return Ans;
}
template <typename T>
T ModInverse(T p, T Mod) {
  return BigMod(p, Mod - 2, Mod);
}
const int X[] = {+1, +1, -1, -1, -1, +1, 0, 0};
const int Y[] = {+1, -1, +1, -1, 0, 0, +1, -1};
const int mx = 1e5 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const long double PI = 2 * acos(0.0);
const long double E = 2.71828182845904523536;
const long double eps = 1e-9;
short n, m;
int k;
vector<short> g[3000 + 5];
set<short> st[3005][3005];
short d[3005][3005];
short p[3005][3005];
void bfs(short x, short y) {
  queue<pair<short, short> > q;
  q.push(make_pair(x, y));
  d[0][0] = 0;
  while (!q.empty()) {
    pair<short, short> u = q.front();
    q.pop();
    for (auto y : g[u.second]) {
      if (p[u.second][y] != -1 || st[u.first][u.second].count(y)) continue;
      p[u.second][y] = u.first;
      q.push(make_pair(u.second, y));
      d[u.second][y] = d[u.first][u.second] + 1;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  cin >> n >> m >> k;
  for (short i = 0; i < n; i++)
    for (short j = 0; j < n; j++) {
      d[i][j] = SHRT_MAX;
      p[i][j] = -1;
    }
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  for (int i = 0; i < k; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--, y--, z--;
    st[x][y].insert(z);
  }
  bfs(0, 0);
  int save = -1;
  short dis = SHRT_MAX;
  for (int i = 0; i < n; i++) {
    if (d[i][n - 1] < dis) {
      dis = d[i][n - 1];
      save = i;
    }
  }
  if (dis == SHRT_MAX) {
    cout << -1;
    return 0;
  }
  cout << dis << endl;
  vector<int> ans;
  pair<short, short> cur = {save, n - 1};
  while (cur.first != -1) {
    ans.push_back(cur.second);
    short temp = cur.first;
    cur.first = p[cur.first][cur.second];
    cur.second = temp;
  }
  reverse(ans.begin(), ans.end());
  for (auto x : ans) cout << x + 1 << " ";
  return 0;
}
