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

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

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

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

l = A("l")
n = B("n")
e = C("e")
i = D("i")
a = D("a")

l.r = e
n.y = a
n.r = e
e.t = n
i.u = n
i.q = n
i.o = n
i.y = a
a.u = n
a.q = n
a.o = n
a.y = i
assert e.t.r.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
e = C("e")
i = D("i")
a = D("a")

l.r = e
n.y = a
n.r = e
e.t = n
i.u = n
i.q = n
i.o = n
i.y = a
a.u = n
a.q = n
a.o = n
a.y = i
assert e.t.r.t.y.txt == "a"