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

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: C = None
        self.z: C = None
        self.txt = txt

i = A("i")
g = B("g")
l = C("l")
a = B("a")
b = A("b")
n = A("n")
d = C("d")
h = C("h")
f = A("f")

i.z = l
i.t = g
g.r = a
l.t = h
l.z = h
l.q = d
a.r = g
b.z = h
b.t = a
n.z = h
n.t = a
d.t = l
d.q = h
d.z = h
h.t = d
h.q = d
h.z = d
f.z = d
f.t = a
assert b.t.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: C = None
        self.z: C = None
        self.txt = txt

i = A("i")
g = B("g")
l = C("l")
a = B("a")
b = A("b")
n = A("n")
d = C("d")
h = C("h")
f = A("f")

i.z = l
i.t = g
g.r = a
l.t = h
l.z = h
l.q = d
a.r = g
b.z = h
b.t = a
n.z = h
n.t = a
d.t = l
d.q = h
d.z = h
h.t = d
h.q = d
h.z = d
f.z = d
f.t = a
assert b.t.r.r.r.r.txt == "a"