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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: C = None
        self.r: B = None
        self.w: D = None
        self.txt = txt

a = A("a")
h = B("h")
k = C("k")
d = D("d")
m = E("m")
e = C("e")
b = E("b")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: C = None
        self.r: B = None
        self.w: D = None
        self.txt = txt

a = A("a")
h = B("h")
k = C("k")
d = D("d")
m = E("m")
e = C("e")
b = E("b")

a.s = k
h.y = k
h.t = b
h.z = a
k.z = d
k.x = d
k.w = a
k.y = a
d.q = a
d.v = a
m.z = b
m.x = e
m.r = h
m.w = d
e.z = d
e.x = d
e.w = a
e.y = a
b.z = m
b.x = k
b.r = h
b.w = d
assert e.w.s.x.q.txt == "a"