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: B = None
        self.x: A = None
        self.txt = txt

c = A("c")
k = B("k")
i = C("i")
h = B("h")
b = A("b")
f = A("f")
l = A("l")
j = C("j")

c.w = l
k.u = b
i.q = k
i.x = f
h.u = c
b.w = l
f.w = c
l.w = f
j.q = h
j.x = f
assert k.u.w.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: B = None
        self.x: A = None
        self.txt = txt

c = A("c")
k = B("k")
i = C("i")
h = B("h")
b = A("b")
f = A("f")
l = A("l")
j = C("j")

c.w = l
k.u = b
i.q = k
i.x = f
h.u = c
b.w = l
f.w = c
l.w = f
j.q = h
j.x = f
assert k.u.w.w.w.w.w.w.w.txt == "l"