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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: E = None
        self.v: A = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

b = A("b")
j = B("j")
f = C("f")
c = D("c")
l = E("l")

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.p: E = None
        self.v: A = None
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

b = A("b")
j = B("j")
f = C("f")
c = D("c")
l = E("l")

b.z = f
b.s = j
b.v = j
b.w = c
j.r = c
f.t = c
f.y = j
f.z = l
c.w = l
c.p = l
c.q = l
c.v = b
l.s = f
assert f.z.s.t.v.s.txt == "j"