class A:
    def __init__(self, txt: str):
        self.w: A = 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.q: C = None
        self.y: B = None
        self.w: C = None
        self.txt = txt

e = A("e")
j = B("j")
d = C("d")
k = C("k")
c = C("c")
h = B("h")
n = A("n")
i = A("i")
b = C("b")
m = B("m")

e.w = i
j.u = e
d.q = b
d.y = h
d.w = c
k.q = b
k.y = h
k.w = c
c.q = d
c.w = d
c.y = h
h.u = i
n.w = e
i.w = e
b.q = k
b.w = k
b.y = h
m.u = i
assert n.w.w.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = 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.q: C = None
        self.y: B = None
        self.w: C = None
        self.txt = txt

e = A("e")
j = B("j")
d = C("d")
k = C("k")
c = C("c")
h = B("h")
n = A("n")
i = A("i")
b = C("b")
m = B("m")

e.w = i
j.u = e
d.q = b
d.y = h
d.w = c
k.q = b
k.y = h
k.w = c
c.q = d
c.w = d
c.y = h
h.u = i
n.w = e
i.w = e
b.q = k
b.w = k
b.y = h
m.u = i
assert n.w.w.w.w.w.w.txt == "i"