package main

import (
	"bufio"
	"fmt"
	"os"
)
var N =100003
type LinkCutTree struct {
	n int
	prt, left, right, sz, rev []int   ///[N]int
	key, val []int
}
func (lct *LinkCutTree) update(i, l, r int) {
	lct.sz[i] = 1 + lct.sz[l] + lct.sz[r]
	lct.val[i] = lct.key[i] + lct.val[l] + lct.val[r]
}

func (lct *LinkCutTree) node_swap(i int) {
	if(i>0) {
	lct.swap(&lct.left[i], &lct.right[i]);
	lct.rev[i] ^= 1;
	}
}
func (lct *LinkCutTree) swap(i, j *int) {
	temp := *i
	*i=*j
	*j=temp
	}

func (lct *LinkCutTree)  prop(i int) bool {
	if(lct.rev[i]>0) {
		lct.node_swap(lct.left[i]);
		lct.node_swap(lct.right[i]);
		lct.rev[i] = 0;
		return true;
	}
	return false;
}

func (lct *LinkCutTree) splay(i int) {
	x := lct.prt[i]
	lct.prop(i)

	li := lct.left[i]
	ri := lct.right[i]
	for x>0 && (lct.left[x] == i || lct.right[x] == i) {
		y := lct.prt[x]
		if y == 0 || (lct.left[y] != x && lct.right[y] != x) {
			if (lct.prop(x)) {
				lct.swap(&li, &ri)
				lct.node_swap(li)
				lct.node_swap(ri)
			}
			if lct.left[x] == i {
				lct.left[x] = ri
				lct.prt[ri] = x
				lct.update(x, ri, lct.right[x])
				ri = x
			} else {
				lct.right[x] = li
				lct.prt[li] = x
				lct.update(x, lct.left[x], li)
				li = x
			}
			x = y
			break
		}
		lct.prop(y)
		if lct.prop(x) {
			lct.swap(&li, &ri)
			lct.node_swap(li)
			lct.node_swap(ri)
		}
		z := lct.prt[y]
		if (lct.left[y] == x) {
			if (lct.left[x] == i) {
				v := lct.right[x]
				lct.left[y] = lct.right[x]
				lct.prt[v] = y
				lct.update(y, v, lct.right[y])

				lct.left[x] = ri
				lct.right[x] = y
				lct.prt[ri] = x
				lct.update(x, ri, y)

				lct.prt[y] = x
				ri = x
			} else {
				lct.left[y] = ri
				lct.prt[ri] = y
				lct.update(y, ri, lct.right[y])

				lct.right[x] = li
				lct.prt[li] = x
				lct.update(x, lct.left[x], li)

				li = x;
				ri = y;
			}
		} else {
			if lct.right[x] == i {
				v := lct.left[x]
				lct.right[y] = lct.left[x]
				lct.prt[v] = y
				lct.update(y, lct.left[y], v)

				lct.left[x] = y
				lct.right[x] = li
				lct.prt[li] = x
				lct.update(x, y, li)

				lct.prt[y] = x
				li = x
			} else {
				lct.right[y] = li
				lct.prt[li] = y
				lct.update(y, lct.left[y], li)

				lct.left[x] = ri
				lct.prt[ri] = x
				lct.update(x, ri, lct.right[x])

				li = y
				ri = x
			}
		}
		x = z
		if lct.left[x] == y {
			lct.left[z] = i
			lct.update(z, i, lct.right[z])
		} else if lct.right[z] == y {
			lct.right[z] = i
			lct.update(z, lct.left[z], i)
		} else {
			break
		}
	}

	lct.update(i, li, ri)
	lct.left[i] = li
	lct.right[i] = ri
	lct.prt[li] = i
	lct.prt[ri] = i
	lct.prt[i] = x

	lct.rev[i] = 0
	lct.prt[0] = 0
}
func (lct *LinkCutTree) expose(i int) int{
	p := 0
	cur := i
	for cur>0 {
		lct.splay(cur)
		lct.right[cur] = p
		lct.update(cur, lct.left[cur], p)
		p = cur
		cur = lct.prt[cur]
	}
	lct.splay(i)
	return i
}

func (lct *LinkCutTree) cut(i int) int {
	lct.expose(i)
	p := lct.left[i]
	lct.left[i] = 0
	lct.prt[p] = 0
	return p
}

func (lct *LinkCutTree) link(i, p int) {
	lct.expose(i)
	lct.expose(p)
	lct.prt[i] = p
	lct.right[p] = i
}
func (lct *LinkCutTree) evert(i int) {
	lct.expose(i)
	lct.node_swap(i)
	lct.prop(i)
}

func (lct *LinkCutTree)InitLinkCutTree(n int) {
	lct.n=n
	lct.prt=make([]int,N)
	lct.left=make([]int,N)
	lct.right=make([]int,N)
	lct.rev=make([]int,N)
	lct.sz=make([]int,N)
	lct.key=make([]int,N)
	lct.val=make([]int,N)
	for i:=0; i<n+1; i++{
		lct.prt[i]=0
		lct.left[i]=0
		lct.right[i]=0
		lct.rev[i]=0
		lct.sz[i]=1
	}
	lct.sz[0] = 0
	lct.left[0] =-1
	lct.right[0] = -1
}

func (lct *LinkCutTree) query(v int) int{
	r := lct.expose(v+1)
	return lct.val[r]
}

func (lct *LinkCutTree) query_add(v, w int) {
	lct.key[v+1] += w
	lct.expose(v+1)
}
var in=bufio.NewReader(os.Stdin)
var out=bufio.NewWriter(os.Stdout)
func main() {
	var n int
	fmt.Fscanf(in,"%d\n",&n)
	var lct LinkCutTree
	lct.InitLinkCutTree(n)
	for i:=0; i<n; i++ {
		var k int
		fmt.Fscanf(in,"%d",&k)
		for j := 0; j < k; j++ {
			var c int
			fmt.Fscanf(in,"%d",&c)
			lct.link(c+1, i+1);
		}
		fmt.Fscanf(in,"\n")
	}
	var q int
	fmt.Fscanf(in,"%d\n",&q)
	for i:=0; i<q; i++ {
		var t int
		fmt.Fscanf(in, "%d", &t)
		if t > 0 {
			var u int
			fmt.Fscanf(in, "%d\n", &u)
			fmt.Fprintf(out, "%d\n", lct.query(u))
			out.Flush()
		} else {
			var v, w int
			fmt.Fscanf(in, "%d %d\n", &v, &w)
			lct.query_add(v, w)
		}
	}
}


Measured memory_bytes: 13464