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

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

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

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

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

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

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

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

i.o = f
i.r = j
c.z = h
c.v = i
h.o = f
j.o = g
l.o = f
l.r = h
g.z = j
g.v = a
a.o = f
a.r = h
f.z = j
f.v = l
k.z = h
k.v = i
assert l.o.z.o.v.r.o.txt == "f"