class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

c = A("c")
i = B("i")
l = C("l")
e = D("e")
b = B("b")

c.r = e
i.t = c
i.u = l
l.o = b
e.t = l
e.x = i
b.t = c
b.u = l
assert c.r.x.t.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

c = A("c")
i = B("i")
l = C("l")
e = D("e")
b = B("b")

c.r = e
i.t = c
i.u = l
l.o = b
e.t = l
e.x = i
b.t = c
b.u = l
assert c.r.x.t.r.t.txt == "l"