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

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

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

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

j = A("j")
b = B("b")
m = C("m")
l = D("l")
e = D("e")

j.r = e
j.u = b
j.y = l
j.o = m
b.x = e
m.t = b
m.x = b
m.q = j
l.s = j
l.o = j
e.s = j
e.o = j
assert m.q.y.s.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.u: B = None
        self.y: D = None
        self.o: C = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
m = C("m")
l = D("l")
e = D("e")

j.r = e
j.u = b
j.y = l
j.o = m
b.x = e
m.t = b
m.x = b
m.q = j
l.s = j
l.o = j
e.s = j
e.o = j
assert m.q.y.s.y.txt == "l"