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

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

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

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

f = A("f")
j = B("j")
k = C("k")
l = D("l")
n = B("n")

f.o = l
f.q = l
j.u = n
j.s = f
k.r = n
l.y = n
n.u = j
n.s = f
assert j.s.q.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: D = None
        self.txt = txt

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

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

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

f = A("f")
j = B("j")
k = C("k")
l = D("l")
n = B("n")

f.o = l
f.q = l
j.u = n
j.s = f
k.r = n
l.y = n
n.u = j
n.s = f
assert j.s.q.y.s.txt == "f"