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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.s: D = None
        self.p: D = None
        self.u: D = None
        self.txt = txt

l = A("l")
f = B("f")
k = C("k")
d = D("d")
n = E("n")
h = D("h")
g = D("g")
c = E("c")
i = A("i")
m = A("m")

l.t = k
l.s = k
f.s = k
f.x = k
k.u = i
d.v = g
d.x = g
d.y = c
d.w = f
n.x = k
n.w = h
n.s = h
n.u = h
n.p = d
h.v = d
h.y = c
h.x = g
h.w = f
g.v = h
g.x = h
g.y = c
g.w = f
c.x = k
c.w = g
c.u = g
c.s = h
c.p = h
i.t = k
i.s = k
m.t = k
m.s = k
assert m.t.u.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: C = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: D = None
        self.s: D = None
        self.p: D = None
        self.u: D = None
        self.txt = txt

l = A("l")
f = B("f")
k = C("k")
d = D("d")
n = E("n")
h = D("h")
g = D("g")
c = E("c")
i = A("i")
m = A("m")

l.t = k
l.s = k
f.s = k
f.x = k
k.u = i
d.v = g
d.x = g
d.y = c
d.w = f
n.x = k
n.w = h
n.s = h
n.u = h
n.p = d
h.v = d
h.y = c
h.x = g
h.w = f
g.v = h
g.x = h
g.y = c
g.w = f
c.x = k
c.w = g
c.u = g
c.s = h
c.p = h
i.t = k
i.s = k
m.t = k
m.s = k
assert m.t.u.s.u.s.txt == "k"