#include <bits/stdc++.h>
using namespace std;
const int maxe = 100100;
const long long inf = 1ll << 50;
namespace graph {
int nxt[maxe], head[maxe], from[maxe], cost[maxe], to[maxe], cnt = 0;
void init() { memset(head, -1, sizeof(head)); }
void addEdge(int u, int v, int w) {
  nxt[cnt] = head[u];
  head[u] = cnt;
  to[cnt] = v;
  from[cnt] = u;
  cost[cnt] = w;
  cnt++;
}
};  // namespace graph
long long dist[maxe];
int n, m;
void init() {
  for (int e = 1; e <= n; e++) dist[e] = inf;
  priority_queue<pair<long long, int> > pq;
  pq.push(make_pair(0, 1));
  dist[1] = 0;
  while (!pq.empty()) {
    long long D;
    int cur;
    tie(D, cur) = pq.top();
    pq.pop();
    D *= -1;
    if (dist[cur] != D) continue;
    for (int ed = graph::head[cur]; ~ed; ed = graph::nxt[ed]) {
      if (dist[graph::to[ed]] > D + graph::cost[ed]) {
        dist[graph::to[ed]] = D + graph::cost[ed];
        pq.push(make_pair(-dist[graph::to[ed]], graph::to[ed]));
      }
    }
  }
  for (int e = 0; e < m; e++)
    graph::cost[e] =
        min(dist[graph::from[e]] - dist[graph::to[e]] + graph::cost[e], inf);
}
int value[maxe * 30], nxt[maxe * 30], tocount = 0;
struct myQueue {
  int head;
  int last;
  void clear() { head = last = -1; }
  void push(int u) {
    value[tocount] = u;
    nxt[tocount] = -1;
    if (last != -1) {
      nxt[last] = tocount;
      last = tocount;
    } else {
      head = last = tocount;
    }
    tocount++;
    assert(tocount < maxe * 30);
  }
  int front() {
    int ans = value[head];
    head = nxt[head];
    if (head == -1) last = -1;
    return ans;
  }
  bool empty() { return head == -1; }
};
myQueue q[maxe];
int rdist[maxe], visited[maxe], cn;
void reboot() {
  for (int e = 0; e <= n; e++) q[e].clear();
  for (int e = 1; e <= n; e++) rdist[e] = n;
  rdist[1] = 0;
  ++cn;
  tocount = 0;
  q[0].push(1);
  for (int lv = 0; lv < n; lv++) {
    while (!q[lv].empty()) {
      int ve = q[lv].front();
      if (visited[ve] == cn) continue;
      visited[ve] = cn;
      for (int ed = graph::head[ve]; ~ed; ed = graph::nxt[ed]) {
        if (rdist[graph::to[ed]] > lv + graph::cost[ed]) {
          rdist[graph::to[ed]] = lv + graph::cost[ed];
          q[lv + graph::cost[ed]].push(graph::to[ed]);
        }
      }
    }
  }
  for (int e = 0; e < m; e++)
    graph::cost[e] += rdist[graph::from[e]] - rdist[graph::to[e]];
  for (int e = 1; e <= n; e++) dist[e] += rdist[e], dist[e] = min(dist[e], inf);
}
int main() {
  graph::init();
  memset(nxt, -1, sizeof(nxt));
  int q;
  scanf("%d %d %d", &n, &m, &q);
  for (int e = 0; e < m; e++) {
    int u, v, w;
    scanf("%d %d %d", &u, &v, &w);
    graph::addEdge(u, v, w);
  }
  init();
  int tot = 0;
  for (int e = 0; e < q; e++) {
    int type;
    scanf("%d", &type);
    if (type == 1) {
      int ver;
      scanf("%d", &ver);
      if (dist[ver] == inf)
        printf("-1\n");
      else
        printf("%lld\n", dist[ver]);
    } else {
      int cnt;
      scanf("%d", &cnt);
      tot += cnt;
      for (; cnt--;) {
        int v;
        scanf("%d", &v);
        graph::cost[v - 1]++;
      }
      reboot();
    }
  }
  return 0;
}
