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

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

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

i = A("i")
d = B("d")
b = C("b")
a = A("a")
e = A("e")
c = C("c")
n = A("n")
f = A("f")
h = A("h")

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

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

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

i = A("i")
d = B("d")
b = C("b")
a = A("a")
e = A("e")
c = C("c")
n = A("n")
f = A("f")
h = A("h")

i.z = d
i.r = b
d.y = c
b.z = d
b.w = c
b.t = c
a.z = d
a.r = b
e.z = d
e.r = c
c.z = d
c.w = b
c.t = b
n.z = d
n.r = c
f.z = d
f.r = b
h.z = d
h.r = b
assert e.r.z.y.z.y.t.t.z.y.txt == "c"