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

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

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

h = A("h")
f = B("f")
a = C("a")
d = A("d")
i = B("i")
n = A("n")
e = A("e")
k = C("k")
j = C("j")

h.o = k
f.z = i
f.v = j
a.r = k
a.u = i
d.o = j
i.z = f
i.v = k
n.o = a
e.o = j
k.r = j
k.u = f
j.r = a
j.u = i
assert f.z.v.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
a = C("a")
d = A("d")
i = B("i")
n = A("n")
e = A("e")
k = C("k")
j = C("j")

h.o = k
f.z = i
f.v = j
a.r = k
a.u = i
d.o = j
i.z = f
i.v = k
n.o = a
e.o = j
k.r = j
k.u = f
j.r = a
j.u = i
assert f.z.v.r.r.r.r.r.txt == "a"