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

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

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

g = A("g")
k = B("k")
l = C("l")
f = C("f")
h = C("h")
a = A("a")
j = A("j")

g.z = l
k.p = h
l.u = k
l.o = k
f.u = k
f.o = k
h.u = k
h.o = k
a.z = l
j.z = l
assert h.u.p.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

g = A("g")
k = B("k")
l = C("l")
f = C("f")
h = C("h")
a = A("a")
j = A("j")

g.z = l
k.p = h
l.u = k
l.o = k
f.u = k
f.o = k
h.u = k
h.o = k
a.z = l
j.z = l
assert h.u.p.o.txt == "k"