class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

m = A("m")
a = B("a")
k = C("k")
h = D("h")
c = E("c")

m.q = c
m.r = c
a.s = c
k.x = h
k.w = a
k.v = a
k.y = a
h.p = a
h.q = a
c.u = h
assert c.u.q.s.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.r: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

m = A("m")
a = B("a")
k = C("k")
h = D("h")
c = E("c")

m.q = c
m.r = c
a.s = c
k.x = h
k.w = a
k.v = a
k.y = a
h.p = a
h.q = a
c.u = h
assert c.u.q.s.u.q.txt == "a"