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

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

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

m = A("m")
i = B("i")
f = C("f")
k = C("k")
n = C("n")
e = B("e")

m.z = i
m.p = n
m.t = k
i.q = e
i.v = n
i.x = m
f.t = i
f.r = n
f.o = n
k.t = e
k.r = n
k.o = n
n.t = e
n.r = f
n.o = k
e.q = i
e.v = f
e.x = m
assert f.r.o.t.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: C = None
        self.t: C = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
f = C("f")
k = C("k")
n = C("n")
e = B("e")

m.z = i
m.p = n
m.t = k
i.q = e
i.v = n
i.x = m
f.t = i
f.r = n
f.o = n
k.t = e
k.r = n
k.o = n
n.t = e
n.r = f
n.o = k
e.q = i
e.v = f
e.x = m
assert f.r.o.t.v.t.txt == "i"