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

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

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

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

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

b = A("b")
j = B("j")
d = C("d")
m = D("m")
k = E("k")

b.y = d
b.t = d
j.s = k
j.x = m
d.q = m
d.w = m
d.z = j
d.t = j
d.y = k
m.t = d
m.v = d
m.r = d
m.o = j
k.x = j
k.q = j
k.t = b
k.w = m
k.p = d
assert d.z.x.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

b = A("b")
j = B("j")
d = C("d")
m = D("m")
k = E("k")

b.y = d
b.t = d
j.s = k
j.x = m
d.q = m
d.w = m
d.z = j
d.t = j
d.y = k
m.t = d
m.v = d
m.r = d
m.o = j
k.x = j
k.q = j
k.t = b
k.w = m
k.p = d
assert d.z.x.v.w.txt == "m"