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

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

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

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

j.y = f
j.z = g
j.v = k
k.r = g
k.w = f
a.o = e
i.y = f
i.z = b
i.v = k
b.o = i
g.o = i
f.r = a
f.w = k
l.y = k
l.z = a
l.v = f
e.y = f
e.z = g
e.v = k
assert e.v.r.o.v.w.w.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: C = None
        self.v: B = None
        self.txt = txt

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

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

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

j.y = f
j.z = g
j.v = k
k.r = g
k.w = f
a.o = e
i.y = f
i.z = b
i.v = k
b.o = i
g.o = i
f.r = a
f.w = k
l.y = k
l.z = a
l.v = f
e.y = f
e.z = g
e.v = k
assert e.v.r.o.v.w.w.r.o.txt == "i"