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

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

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

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

l = A("l")
n = B("n")
b = C("b")
e = D("e")
a = B("a")
m = C("m")
i = C("i")
h = A("h")
c = C("c")
g = C("g")

l.u = a
l.y = m
l.p = g
n.w = a
b.x = l
b.t = m
e.o = h
e.u = a
e.t = c
a.w = n
m.x = l
m.t = c
i.x = l
i.t = b
h.u = n
h.y = c
h.p = b
c.x = l
c.t = m
g.x = h
g.t = i
assert l.y.x.y.x.u.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: C = None
        self.p: C = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
b = C("b")
e = D("e")
a = B("a")
m = C("m")
i = C("i")
h = A("h")
c = C("c")
g = C("g")

l.u = a
l.y = m
l.p = g
n.w = a
b.x = l
b.t = m
e.o = h
e.u = a
e.t = c
a.w = n
m.x = l
m.t = c
i.x = l
i.t = b
h.u = n
h.y = c
h.p = b
c.x = l
c.t = m
g.x = h
g.t = i
assert l.y.x.y.x.u.w.w.w.w.w.txt == "n"