#include <bits/stdc++.h>
using namespace std;
struct Forbid {
  int x, y, z;
  void Read() { scanf("%d%d%d", &x, &y, &z); }
};
int n, m, k;
vector<int> adj[3001];
bool vis[3001][3001];
vector<Forbid> F;
bool cmp(Forbid a, Forbid b) {
  if (a.x != b.x) return a.x < b.x;
  if (a.y != b.y) return a.y < b.y;
  return a.z < b.z;
}
int VAL(int id, int col) {
  if (col == 1) {
    return F[id].x;
  } else if (col == 2) {
    return F[id].y;
  } else {
    return F[id].z;
  }
}
bool BS(int L, int R, int val, int col) {
  int l = L, r = R, m;
  while (l <= r) {
    m = (l + r) >> 1;
    int value = VAL(m, col);
    if (value == val)
      return 1;
    else if (value < val)
      l = m + 1;
    else
      r = m - 1;
  }
  return false;
}
pair<int, int> Borders(int L, int R, int val, int col) {
  int l = L, r = R, m;
  pair<int, int> ret(-1, -1);
  while (l <= r) {
    m = (l + r) >> 1;
    int value = VAL(m, col);
    if (value <= val) {
      if (value == val) {
        ret.first = m;
        r = m - 1;
      } else
        l = m + 1;
    } else
      r = m - 1;
  }
  if (ret.first == -1) return ret;
  l = ret.first, r = R;
  while (l <= r) {
    m = (l + r) >> 1;
    int value = VAL(m, col);
    if (value <= val) {
      if (value == val) {
        ret.second = m;
      }
      l = m + 1;
    } else
      r = m - 1;
  }
  return ret;
}
int Found(vector<int> For, int add) {
  if ((int)F.size() == 0) return 1;
  For.push_back(add);
  if ((int)For.size() == 1) {
    if (BS(0, (int)F.size() - 1, add, 1))
      return 2;
    else
      return 1;
  } else if ((int)For.size() == 2) {
    pair<int, int> borders = Borders(0, (int)F.size() - 1, For[0], 1);
    if (BS(borders.first, borders.second, For[1], 2)) {
      return 2;
    } else
      return 1;
  } else if ((int)For.size() == 3) {
    pair<int, int> borders = Borders(0, (int)F.size() - 1, For[0], 1);
    borders = Borders(borders.first, borders.second, For[1], 2);
    if (BS(borders.first, borders.second, For[2], 3))
      return 3;
    else
      return 1;
  }
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < k; i++) {
    Forbid tm;
    tm.Read();
    F.push_back(tm);
  }
  sort(F.begin(), F.end(), cmp);
  queue<pair<pair<int, vector<int>>, vector<int>>> B;
  B.push({{1, vector<int>(1, 1)}, vector<int>(1, 1)});
  vis[1][0] = 1;
  while (!B.empty()) {
    vector<int> v = B.front().second;
    int cur = B.front().first.first;
    vector<int> For = B.front().first.second;
    B.pop();
    if (cur == n) {
      printf("%d\n", (int)v.size() - 1);
      for (int i = 0; i < (int)v.size(); i++) printf("%d ", v[i]);
      return 0;
    }
    for (auto node : adj[cur]) {
      if (!vis[node][cur]) {
        int ret = Found(For, node);
        if (ret == 1) {
          vis[node][cur] = 1;
          v.push_back(node);
          B.push({{node, vector<int>(1, node)}, v});
          v.pop_back();
        } else if (ret == 2) {
          vis[node][cur] = 1;
          v.push_back(node);
          For.push_back(node);
          B.push({{node, For}, v});
          v.pop_back();
          For.pop_back();
        }
      }
    }
  }
  printf("-1\n");
  return 0;
}
