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

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

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

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

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

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

h.v = l
h.w = n
m.t = n
g.z = h
g.r = m
g.o = n
e.s = n
n.w = g
n.s = m
d.s = n
l.v = h
l.w = n
assert g.o.s.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.w: E = None
        self.txt = txt

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

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

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

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

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

h.v = l
h.w = n
m.t = n
g.z = h
g.r = m
g.o = n
e.s = n
n.w = g
n.s = m
d.s = n
l.v = h
l.w = n
assert g.o.s.t.s.t.txt == "n"