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

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

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

n = A("n")
j = B("j")
e = C("e")
f = B("f")
b = C("b")
i = A("i")
a = C("a")

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

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

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

n = A("n")
j = B("j")
e = C("e")
f = B("f")
b = C("b")
i = A("i")
a = C("a")

n.w = j
n.r = i
j.v = i
j.z = e
e.o = j
f.v = i
f.z = e
b.o = j
i.w = j
i.r = n
a.o = f
assert i.w.z.o.z.o.z.o.txt == "j"