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

class B:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: B = None
        self.r: A = None
        self.txt = txt

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

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

c.w = l
e.u = k
e.z = f
e.r = g
i.u = h
i.w = h
l.w = g
k.u = e
k.z = f
k.r = g
h.u = i
h.w = i
f.u = e
f.z = e
f.r = g
g.w = l
assert l.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: B = None
        self.z: B = None
        self.r: A = None
        self.txt = txt

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

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

c.w = l
e.u = k
e.z = f
e.r = g
i.u = h
i.w = h
l.w = g
k.u = e
k.z = f
k.r = g
h.u = i
h.w = i
f.u = e
f.z = e
f.r = g
g.w = l
assert l.w.w.w.w.w.w.w.txt == "g"