class A:
    def __init__(self, txt: str):
        self.w: 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.x: E = None
        self.s: D = None
        self.u: B = None
        self.txt = txt

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

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

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

n.w = d
l.x = d
d.x = b
d.s = i
d.u = c
i.w = f
b.y = h
b.w = n
b.s = n
b.t = e
e.x = d
f.w = i
h.y = b
h.w = n
h.s = n
h.t = e
c.x = d
assert c.x.u.x.x.y.y.w.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: 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.x: E = None
        self.s: D = None
        self.u: B = None
        self.txt = txt

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

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

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

n.w = d
l.x = d
d.x = b
d.s = i
d.u = c
i.w = f
b.y = h
b.w = n
b.s = n
b.t = e
e.x = d
f.w = i
h.y = b
h.w = n
h.s = n
h.t = e
c.x = d
assert c.x.u.x.x.y.y.w.w.s.txt == "i"