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

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

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

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

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

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

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

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

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