#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int q;
vector<pair<int, int> > v[100002];
pair<int, int> ed[100002];
int id1[100002];
int id2[100002];
long long int dist[100002];
priority_queue<pair<long long int, int>, vector<pair<long long int, int> >,
               greater<pair<long long int, int> > >
    qq;
int inc[100002];
pair<int, int> ar[2 * 100002];
int star[100002];
int en[100002];
int C[100002];
int top[1000002];
int pr[1000002];
int val[5000002];
int sz;
int read_int() {
  int num = 0;
  while (1) {
    char c = getchar();
    if (!isdigit(c)) {
      continue;
    }
    num += c - '0';
    break;
  }
  while (1) {
    char c = getchar();
    if (!isdigit(c)) {
      return num;
    }
    num *= 10;
    num += c - '0';
  }
}
int main() {
  cin >> n >> m >> q;
  for (int i = 0; i < m; i++) {
    int a, b, c;
    a = read_int();
    b = read_int();
    c = read_int();
    a--;
    b--;
    id1[i] = v[a].size();
    id2[i] = v[b].size();
    v[a].push_back(make_pair(b, c));
    ed[i] = make_pair(a, b);
    C[i] = c;
  }
  for (int i = 0; i < 100002; i++) {
    dist[i] = LLONG_MAX;
  }
  dist[0] = 0;
  qq.push({0, 0});
  while (!qq.empty()) {
    int b = qq.top().second;
    if (dist[b] != qq.top().first) {
      qq.pop();
      continue;
    }
    qq.pop();
    for (auto c : v[b]) {
      int &go = c.first;
      long long int cost = dist[b] + c.second;
      if (dist[go] > cost) {
        dist[go] = cost;
        qq.push({cost, go});
      }
    }
  }
  int las_ty = 1;
  int mxx = 0;
  int zz = 0;
  for (int i = 0; i < n; i++) {
    star[i] = zz;
    for (int j = 0; j < v[i].size(); j++) {
      ar[zz] = v[i][j];
      ar[zz].second = 0;
      zz++;
    }
    en[i] = zz;
  }
  for (int i = 0; i < m; i++) {
    if (dist[ed[i].first] == LLONG_MAX) continue;
    ar[star[ed[i].first] + id1[i]].second =
        C[i] + dist[ed[i].first] - dist[ed[i].second];
  }
  memset(top, -1, sizeof(top));
  while (q--) {
    int ty = read_int();
    if (ty == 1 && las_ty == 2) {
      for (int i = 0; i < n; i++) inc[i] = INT_MAX;
      inc[0] = 0;
      sz = 0;
      pr[sz] = top[0];
      top[0] = sz;
      val[sz] = 0;
      sz++;
      for (int j = 0; j <= mxx; j++) {
        for (; top[j] != -1;) {
          int cur = val[top[j]];
          top[j] = pr[top[j]];
          if (inc[cur] != j) continue;
          int cost = inc[cur];
          for (int idx = star[cur]; idx < en[cur]; idx++) {
            int go = ar[idx].first;
            int nex = inc[cur] + ar[idx].second;
            if (inc[go] > nex && nex <= mxx) {
              inc[go] = nex;
              pr[sz] = top[nex];
              top[nex] = sz;
              val[sz] = go;
              sz++;
            }
            ar[idx].second = 0;
          }
        }
      }
      for (int i = 0; i < n; i++)
        if (inc[i] != INT_MAX) dist[i] += inc[i];
      for (int i = 0; i < m; i++) {
        if (dist[ed[i].first] == LLONG_MAX) continue;
        ar[star[ed[i].first] + id1[i]].second =
            C[i] + dist[ed[i].first] - dist[ed[i].second];
      }
      mxx = 0;
    }
    las_ty = ty;
    if (ty == 2) {
      int cnt = read_int();
      for (int j = 0; j < cnt; j++) {
        int id = read_int();
        id--;
        ar[star[ed[id].first] + id1[id]].second++;
        C[id]++;
      }
      mxx += cnt;
      continue;
    }
    int node;
    node = read_int();
    node--;
    if (dist[node] == LLONG_MAX) {
      puts("-1");
      continue;
    }
    printf("%lld\n", dist[node]);
  }
  return 0;
}
