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

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

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

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

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

b.o = j
b.t = l
b.r = l
j.o = l
j.u = l
j.s = e
e.r = j
e.u = b
l.p = b
l.z = b
l.o = j
assert l.p.o.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.t: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

b.o = j
b.t = l
b.r = l
j.o = l
j.u = l
j.s = e
e.r = j
e.u = b
l.p = b
l.z = b
l.o = j
assert l.p.o.o.p.txt == "b"