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

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

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

i = A("i")
n = B("n")
c = C("c")
h = A("h")
j = B("j")
l = C("l")

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

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

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

i = A("i")
n = B("n")
c = C("c")
h = A("h")
j = B("j")
l = C("l")

i.x = c
i.r = c
i.o = n
n.z = l
n.x = l
n.o = i
c.x = h
c.v = i
h.x = l
h.r = c
h.o = n
j.z = l
j.o = i
j.x = c
l.x = i
l.v = h
assert n.z.v.r.txt == "c"