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

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

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

m = A("m")
i = B("i")
k = C("k")
j = A("j")
l = C("l")

m.r = i
m.w = k
m.u = l
i.r = k
k.y = l
j.r = i
j.w = l
j.u = l
l.y = k
assert k.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: C = None
        self.u: C = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
k = C("k")
j = A("j")
l = C("l")

m.r = i
m.w = k
m.u = l
i.r = k
k.y = l
j.r = i
j.w = l
j.u = l
l.y = k
assert k.y.y.y.txt == "l"