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

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

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

k = A("k")
n = B("n")
l = C("l")

k.w = n
k.p = l
k.o = l
n.z = l
l.u = n
assert n.z.u.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: C = None
        self.o: C = None
        self.txt = txt

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

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

k = A("k")
n = B("n")
l = C("l")

k.w = n
k.p = l
k.o = l
n.z = l
l.u = n
assert n.z.u.z.txt == "l"