class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

k = A("k")
b = B("b")
l = C("l")
m = B("m")
g = B("g")
i = A("i")
n = A("n")
e = C("e")
f = A("f")
h = A("h")

k.t = f
k.r = b
b.p = g
b.s = e
l.r = n
m.p = b
m.s = e
g.p = b
g.s = e
i.t = k
i.r = g
n.t = i
n.r = b
e.r = k
f.t = h
f.r = m
h.t = k
h.r = b
assert g.p.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.s: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

k = A("k")
b = B("b")
l = C("l")
m = B("m")
g = B("g")
i = A("i")
n = A("n")
e = C("e")
f = A("f")
h = A("h")

k.t = f
k.r = b
b.p = g
b.s = e
l.r = n
m.p = b
m.s = e
g.p = b
g.s = e
i.t = k
i.r = g
n.t = i
n.r = b
e.r = k
f.t = h
f.r = m
h.t = k
h.r = b
assert g.p.p.p.txt == "b"