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

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

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

m = A("m")
b = B("b")
d = C("d")
l = B("l")

m.u = d
m.t = l
b.y = m
b.o = d
d.y = m
d.r = m
d.w = l
l.y = m
l.o = d
assert d.w.o.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: B = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
d = C("d")
l = B("l")

m.u = d
m.t = l
b.y = m
b.o = d
d.y = m
d.r = m
d.w = l
l.y = m
l.o = d
assert d.w.o.r.u.txt == "d"