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

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

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

n = A("n")
g = B("g")
l = C("l")
k = A("k")
i = B("i")
b = B("b")

n.y = l
n.o = k
n.x = b
g.r = l
g.z = n
l.o = b
l.v = b
l.r = n
k.y = l
k.o = n
k.x = i
i.r = l
i.z = n
b.r = l
b.z = n
assert i.r.v.r.r.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.o: A = None
        self.x: B = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
l = C("l")
k = A("k")
i = B("i")
b = B("b")

n.y = l
n.o = k
n.x = b
g.r = l
g.z = n
l.o = b
l.v = b
l.r = n
k.y = l
k.o = n
k.x = i
i.r = l
i.z = n
b.r = l
b.z = n
assert i.r.v.r.r.y.o.txt == "b"