class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: A = None
        self.txt = txt

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

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

a = A("a")
j = B("j")
g = C("g")
f = C("f")
c = B("c")
k = B("k")
l = A("l")
i = B("i")

a.y = g
a.v = l
j.w = f
g.s = j
g.t = i
f.s = k
f.t = j
c.w = f
k.w = g
l.y = g
l.v = a
i.w = f
assert j.w.s.w.s.w.s.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: A = None
        self.txt = txt

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

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

a = A("a")
j = B("j")
g = C("g")
f = C("f")
c = B("c")
k = B("k")
l = A("l")
i = B("i")

a.y = g
a.v = l
j.w = f
g.s = j
g.t = i
f.s = k
f.t = j
c.w = f
k.w = g
l.y = g
l.v = a
i.w = f
assert j.w.s.w.s.w.s.w.txt == "g"