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

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

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

m = A("m")
f = B("f")
b = C("b")
g = B("g")
e = C("e")
k = B("k")
i = B("i")
j = C("j")

m.z = j
f.o = g
f.p = e
b.r = m
b.s = m
b.v = e
g.o = k
g.p = b
e.r = m
e.s = m
e.v = b
k.o = i
k.p = b
i.o = g
i.p = b
j.r = m
j.s = m
j.v = b
assert f.o.p.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
b = C("b")
g = B("g")
e = C("e")
k = B("k")
i = B("i")
j = C("j")

m.z = j
f.o = g
f.p = e
b.r = m
b.s = m
b.v = e
g.o = k
g.p = b
e.r = m
e.s = m
e.v = b
k.o = i
k.p = b
i.o = g
i.p = b
j.r = m
j.s = m
j.v = b
assert f.o.p.s.z.txt == "j"