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

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

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

f = A("f")
i = B("i")
j = C("j")
a = C("a")
n = A("n")
l = C("l")
d = B("d")
e = C("e")
h = B("h")

f.q = h
i.z = a
i.u = j
i.y = e
j.v = f
j.u = h
j.o = n
a.v = f
a.u = h
a.o = n
n.q = h
l.v = n
l.u = d
l.o = f
d.z = l
d.u = l
d.y = a
e.v = f
e.o = f
e.u = i
h.z = a
h.u = l
h.y = e
assert n.q.z.o.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

f = A("f")
i = B("i")
j = C("j")
a = C("a")
n = A("n")
l = C("l")
d = B("d")
e = C("e")
h = B("h")

f.q = h
i.z = a
i.u = j
i.y = e
j.v = f
j.u = h
j.o = n
a.v = f
a.u = h
a.o = n
n.q = h
l.v = n
l.u = d
l.o = f
d.z = l
d.u = l
d.y = a
e.v = f
e.o = f
e.u = i
h.z = a
h.u = l
h.y = e
assert n.q.z.o.q.u.txt == "l"