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

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

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

n = A("n")
f = B("f")
j = C("j")
l = C("l")
c = B("c")
k = C("k")
h = C("h")
e = B("e")
d = A("d")

n.r = k
f.z = c
f.q = e
f.u = n
j.r = n
j.q = c
l.r = d
l.q = c
c.z = f
c.q = e
c.u = d
k.r = d
k.q = e
h.r = n
h.q = f
e.z = f
e.q = f
e.u = n
d.r = k
assert j.q.z.u.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

n = A("n")
f = B("f")
j = C("j")
l = C("l")
c = B("c")
k = C("k")
h = C("h")
e = B("e")
d = A("d")

n.r = k
f.z = c
f.q = e
f.u = n
j.r = n
j.q = c
l.r = d
l.q = c
c.z = f
c.q = e
c.u = d
k.r = d
k.q = e
h.r = n
h.q = f
e.z = f
e.q = f
e.u = n
d.r = k
assert j.q.z.u.r.r.r.txt == "k"