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

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

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

f = A("f")
c = B("c")
i = C("i")
m = A("m")
g = C("g")
l = B("l")
n = C("n")
e = B("e")

f.q = g
f.o = l
f.u = l
c.p = e
c.z = m
c.o = m
i.u = f
i.y = f
i.s = m
m.q = g
m.o = e
m.u = l
g.u = f
g.s = f
g.y = m
l.p = e
l.z = m
l.o = m
n.u = f
n.s = f
n.y = m
e.p = l
e.z = m
e.o = f
assert l.p.z.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

f = A("f")
c = B("c")
i = C("i")
m = A("m")
g = C("g")
l = B("l")
n = C("n")
e = B("e")

f.q = g
f.o = l
f.u = l
c.p = e
c.z = m
c.o = m
i.u = f
i.y = f
i.s = m
m.q = g
m.o = e
m.u = l
g.u = f
g.s = f
g.y = m
l.p = e
l.z = m
l.o = m
n.u = f
n.s = f
n.y = m
e.p = l
e.z = m
e.o = f
assert l.p.z.q.y.txt == "m"