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

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

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

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

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

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

h.t = b
h.u = b
h.s = a
e.w = a
e.q = a
e.v = b
a.s = e
b.w = n
b.y = n
b.q = d
n.u = b
d.w = a
d.q = a
d.v = b
assert e.v.q.v.q.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: C = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

h.t = b
h.u = b
h.s = a
e.w = a
e.q = a
e.v = b
a.s = e
b.w = n
b.y = n
b.q = d
n.u = b
d.w = a
d.q = a
d.v = b
assert e.v.q.v.q.q.s.txt == "e"