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

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

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

g = A("g")
e = B("e")
f = C("f")
m = B("m")
c = B("c")
n = C("n")
d = C("d")
i = B("i")
h = A("h")

g.t = m
e.v = f
e.z = c
e.o = m
f.r = d
m.v = f
m.z = i
m.o = e
c.v = d
c.z = i
c.o = i
n.r = f
d.r = f
i.v = f
i.z = e
i.o = m
h.t = i
assert m.z.o.z.o.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
f = C("f")
m = B("m")
c = B("c")
n = C("n")
d = C("d")
i = B("i")
h = A("h")

g.t = m
e.v = f
e.z = c
e.o = m
f.r = d
m.v = f
m.z = i
m.o = e
c.v = d
c.z = i
c.o = i
n.r = f
d.r = f
i.v = f
i.z = e
i.o = m
h.t = i
assert m.z.o.z.o.z.v.txt == "f"