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

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

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

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

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

h = A("h")
b = B("b")
m = C("m")
e = D("e")
i = E("i")
f = D("f")
c = C("c")
n = C("n")

h.u = b
b.w = f
b.t = i
m.y = i
e.v = h
i.s = h
i.q = b
i.u = c
f.v = h
c.y = i
n.y = i
assert m.y.q.t.s.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

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

h = A("h")
b = B("b")
m = C("m")
e = D("e")
i = E("i")
f = D("f")
c = C("c")
n = C("n")

h.u = b
b.w = f
b.t = i
m.y = i
e.v = h
i.s = h
i.q = b
i.u = c
f.v = h
c.y = i
n.y = i
assert m.y.q.t.s.u.w.txt == "f"