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

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

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

f = A("f")
b = B("b")
a = C("a")
j = C("j")
h = B("h")
m = B("m")
k = B("k")
i = B("i")
l = A("l")
e = B("e")

f.w = l
b.y = h
a.q = f
a.x = j
j.q = f
j.x = a
h.y = k
m.y = e
k.y = e
i.y = b
l.w = f
e.y = h
assert b.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
a = C("a")
j = C("j")
h = B("h")
m = B("m")
k = B("k")
i = B("i")
l = A("l")
e = B("e")

f.w = l
b.y = h
a.q = f
a.x = j
j.q = f
j.x = a
h.y = k
m.y = e
k.y = e
i.y = b
l.w = f
e.y = h
assert b.y.y.y.y.y.txt == "k"