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

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

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

c = A("c")
g = B("g")
m = C("m")
e = A("e")
b = B("b")
j = C("j")
n = C("n")
i = A("i")
a = C("a")
l = B("l")

c.y = l
c.r = a
g.t = b
g.r = i
g.x = a
m.v = c
m.z = e
e.y = l
e.r = j
b.t = l
b.r = c
b.x = n
j.v = i
j.z = i
n.v = c
n.z = e
i.y = g
i.r = a
a.v = i
a.z = c
l.t = g
l.r = c
l.x = j
assert i.y.x.v.r.v.r.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: C = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
m = C("m")
e = A("e")
b = B("b")
j = C("j")
n = C("n")
i = A("i")
a = C("a")
l = B("l")

c.y = l
c.r = a
g.t = b
g.r = i
g.x = a
m.v = c
m.z = e
e.y = l
e.r = j
b.t = l
b.r = c
b.x = n
j.v = i
j.z = i
n.v = c
n.z = e
i.y = g
i.r = a
a.v = i
a.z = c
l.t = g
l.r = c
l.x = j
assert i.y.x.v.r.v.r.z.y.txt == "l"