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

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

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

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

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

c.w = k
b.u = e
l.y = d
l.u = h
l.w = h
l.v = m
i.q = l
i.y = l
i.s = l
i.t = e
g.u = d
d.w = i
h.y = e
h.u = l
h.w = l
h.v = i
m.q = l
m.y = l
m.s = l
m.t = e
e.w = k
k.q = l
k.y = l
k.t = c
k.s = h
assert m.t.w.t.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.txt = txt

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

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

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

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

c.w = k
b.u = e
l.y = d
l.u = h
l.w = h
l.v = m
i.q = l
i.y = l
i.s = l
i.t = e
g.u = d
d.w = i
h.y = e
h.u = l
h.w = l
h.v = i
m.q = l
m.y = l
m.s = l
m.t = e
e.w = k
k.q = l
k.y = l
k.t = c
k.s = h
assert m.t.w.t.w.s.w.txt == "l"