#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
template <typename T>
bool cmax(T &a, T b) {
  return (a < b) ? a = b, 1 : 0;
}
template <typename T>
bool cmin(T &a, T b) {
  return (a > b) ? a = b, 1 : 0;
}
template <typename T>
T read() {
  T ans = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch) && ch != '-') ch = getchar();
  if (ch == '-') f = -1, ch = getchar();
  while (isdigit(ch))
    ans = (ans << 3) + (ans << 1) + (ch - '0'), ch = getchar();
  return ans * f;
}
template <typename T>
void write(T x, char y) {
  if (x == 0) {
    putchar('0'), putchar(y);
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  static char wr[20];
  int top = 0;
  for (; x; x /= 10) wr[++top] = x % 10 + '0';
  while (top) putchar(wr[top--]);
  putchar(y);
}
void file() {}
int n, m, q;
int head[N], nex[N], to[N], w[N], tt;
void add(int x, int y, int z) {
  to[++tt] = y, nex[tt] = head[x], head[x] = tt, w[tt] = z;
}
void input() {
  int x, y, z;
  n = read<int>(), m = read<int>(), q = read<int>();
  for (register int i = (int)(1); i <= (int)(m); ++i) {
    x = read<int>(), y = read<int>(), z = read<int>();
    add(x, y, z);
  }
}
long long dis[N];
struct node {
  int id;
  bool operator<(const node &s) const { return dis[id] > dis[s.id]; }
};
priority_queue<node> heap;
const long long inf = 1e18;
void DJ() {
  for (register int i = (int)(1); i <= (int)(n); ++i) dis[i] = inf;
  dis[1] = 0;
  heap.push((node){1});
  int u, v;
  while (!heap.empty()) {
    u = heap.top().id;
    heap.pop();
    for (int i = head[u]; i; i = nex[i]) {
      v = to[i];
      if (cmin(dis[v], dis[u] + w[i])) heap.push((node){v});
    }
  }
}
long long f[N];
queue<int> W[N];
void update(int k) {
  int u, v;
  long long max_d = 0;
  for (int now = 0; now <= max_d; now++) {
    while (!W[now].empty()) {
      u = W[now].front(), W[now].pop();
      assert(f[u] >= 0);
      if (f[u] < now) continue;
      for (int i = head[u]; i; i = nex[i]) {
        v = to[i];
        if (cmin(f[v], f[u] + dis[u] - dis[v] + w[i])) {
          if (f[v] <= k) W[f[v]].push(v), cmax(max_d, f[v]);
        }
      }
    }
  }
  for (register int i = (int)(1); i <= (int)(n); ++i) {
    dis[i] = min(inf, dis[i] + f[i]);
  }
}
void work() {
  int opt, k, x;
  DJ();
  while (q--) {
    opt = read<int>(), k = read<int>();
    if (opt == 1)
      write(dis[k] < inf ? dis[k] : -1, '\n');
    else {
      for (register int i = (int)(1); i <= (int)(k); ++i)
        x = read<int>(), w[x]++;
      for (register int i = (int)(1); i <= (int)(n); ++i) f[i] = inf;
      f[1] = 0;
      W[0].push(1);
      update(k);
    }
  }
}
int main() {
  file();
  input();
  work();
  return 0;
}
