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

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

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

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

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

h = A("h")
l = B("l")
d = C("d")
f = D("f")
e = E("e")
n = C("n")

h.t = l
h.x = n
h.s = d
l.x = d
d.v = l
d.t = e
f.w = e
e.v = f
e.w = f
e.t = l
e.r = l
e.u = h
n.v = l
n.t = e
assert l.x.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: C = None
        self.s: C = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
d = C("d")
f = D("f")
e = E("e")
n = C("n")

h.t = l
h.x = n
h.s = d
l.x = d
d.v = l
d.t = e
f.w = e
e.v = f
e.w = f
e.t = l
e.r = l
e.u = h
n.v = l
n.t = e
assert l.x.t.w.txt == "f"