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

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

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

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

j = A("j")
k = B("k")
c = C("c")
l = D("l")

j.q = k
j.t = k
j.p = c
k.r = j
k.s = j
k.y = l
c.u = j
c.w = j
c.q = l
l.z = c
l.w = j
assert k.y.w.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: C = None
        self.t: B = None
        self.txt = txt

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

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

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

j = A("j")
k = B("k")
c = C("c")
l = D("l")

j.q = k
j.t = k
j.p = c
k.r = j
k.s = j
k.y = l
c.u = j
c.w = j
c.q = l
l.z = c
l.w = j
assert k.y.w.t.s.txt == "j"