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

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

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

e = A("e")
g = B("g")
k = C("k")
a = A("a")
d = B("d")
j = A("j")
m = C("m")
i = A("i")
n = C("n")
l = B("l")

e.w = j
g.t = d
k.q = g
k.z = g
k.p = i
a.w = j
d.t = g
j.w = i
m.q = d
m.z = l
m.p = e
i.w = j
n.q = l
n.z = l
n.p = a
l.t = g
assert e.w.w.w.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.t: B = None
        self.txt = txt

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

e = A("e")
g = B("g")
k = C("k")
a = A("a")
d = B("d")
j = A("j")
m = C("m")
i = A("i")
n = C("n")
l = B("l")

e.w = j
g.t = d
k.q = g
k.z = g
k.p = i
a.w = j
d.t = g
j.w = i
m.q = d
m.z = l
m.p = e
i.w = j
n.q = l
n.z = l
n.p = a
l.t = g
assert e.w.w.w.w.w.w.w.w.w.w.txt == "i"