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

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

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

c = A("c")
m = B("m")
k = C("k")
a = A("a")
h = A("h")
l = A("l")
n = C("n")

c.v = k
c.r = a
c.u = a
m.q = a
k.u = a
k.z = n
k.v = m
a.v = n
a.r = h
a.u = c
h.v = n
h.r = a
h.u = a
l.v = n
l.r = a
l.u = c
n.u = c
n.z = k
n.v = m
assert h.u.r.v.u.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: A = None
        self.u: A = None
        self.txt = txt

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

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

c = A("c")
m = B("m")
k = C("k")
a = A("a")
h = A("h")
l = A("l")
n = C("n")

c.v = k
c.r = a
c.u = a
m.q = a
k.u = a
k.z = n
k.v = m
a.v = n
a.r = h
a.u = c
h.v = n
h.r = a
h.u = a
l.v = n
l.r = a
l.u = c
n.u = c
n.z = k
n.v = m
assert h.u.r.v.u.v.z.txt == "n"