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

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

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

k = A("k")
c = B("c")
f = C("f")
a = C("a")
n = C("n")
i = A("i")
e = A("e")
h = C("h")
l = B("l")

k.w = i
c.q = n
c.y = h
f.p = a
f.u = i
a.p = h
a.u = k
n.p = f
n.u = e
i.w = k
e.w = i
h.p = a
h.u = e
l.q = h
l.y = h
assert i.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.q: C = None
        self.y: C = None
        self.txt = txt

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

k = A("k")
c = B("c")
f = C("f")
a = C("a")
n = C("n")
i = A("i")
e = A("e")
h = C("h")
l = B("l")

k.w = i
c.q = n
c.y = h
f.p = a
f.u = i
a.p = h
a.u = k
n.p = f
n.u = e
i.w = k
e.w = i
h.p = a
h.u = e
l.q = h
l.y = h
assert i.w.w.w.w.w.txt == "k"