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

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

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

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

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

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

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

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

a.u = b
a.s = j
a.o = m
d.q = h
d.r = j
b.y = m
b.v = m
b.s = l
l.u = b
l.o = b
l.s = d
i.u = m
i.s = d
i.o = b
k.u = b
k.o = b
k.s = j
h.u = m
h.s = j
h.o = b
j.q = i
j.r = d
m.y = b
m.v = b
m.s = h
assert j.r.r.q.o.v.txt == "m"