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

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

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

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

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

c = A("c")
j = B("j")
m = C("m")
g = D("g")
l = E("l")

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

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

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

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

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

c = A("c")
j = B("j")
m = C("m")
g = D("g")
l = E("l")

c.y = j
c.z = l
j.z = g
j.q = c
m.z = c
g.q = l
g.t = j
g.w = j
g.p = c
g.r = m
l.x = c
l.u = j
assert j.z.w.q.txt == "c"