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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: A = None
        self.w: A = None
        self.txt = txt

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

l.r = a
l.o = a
l.s = b
l.t = j
j.x = b
j.w = b
j.o = l
j.r = l
a.z = j
a.o = l
b.z = a
b.t = l
b.w = l
assert j.w.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: D = None
        self.t: B = None
        self.o: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: A = None
        self.w: A = None
        self.txt = txt

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

l.r = a
l.o = a
l.s = b
l.t = j
j.x = b
j.w = b
j.o = l
j.r = l
a.z = j
a.o = l
b.z = a
b.t = l
b.w = l
assert j.w.w.t.txt == "j"