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

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

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

m = A("m")
i = B("i")
k = C("k")
j = A("j")
l = B("l")
a = C("a")
d = C("d")
b = C("b")
g = A("g")

m.r = j
m.u = i
m.z = g
i.v = b
i.y = j
k.r = i
k.o = i
k.y = j
j.r = m
j.u = l
j.z = g
l.v = k
l.y = j
a.r = l
a.o = i
a.y = j
d.r = l
d.o = l
d.y = m
b.r = l
b.o = l
b.y = m
g.r = j
g.z = j
g.u = l
assert j.r.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: B = None
        self.z: A = None
        self.txt = txt

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

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

m = A("m")
i = B("i")
k = C("k")
j = A("j")
l = B("l")
a = C("a")
d = C("d")
b = C("b")
g = A("g")

m.r = j
m.u = i
m.z = g
i.v = b
i.y = j
k.r = i
k.o = i
k.y = j
j.r = m
j.u = l
j.z = g
l.v = k
l.y = j
a.r = l
a.o = i
a.y = j
d.r = l
d.o = l
d.y = m
b.r = l
b.o = l
b.y = m
g.r = j
g.z = j
g.u = l
assert j.r.u.v.txt == "b"