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

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

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

c = A("c")
n = B("n")
b = C("b")
l = C("l")
a = B("a")
d = A("d")
m = A("m")
g = A("g")
e = A("e")

c.z = m
c.q = b
c.s = d
n.t = g
n.u = a
b.o = l
b.y = l
b.s = d
l.o = b
l.y = b
l.s = e
a.t = g
a.u = n
d.z = m
d.q = l
d.s = g
m.z = d
m.s = d
m.q = l
g.z = c
g.q = b
g.s = m
e.z = d
e.q = l
e.s = m
assert e.s.q.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: C = None
        self.s: A = None
        self.txt = txt

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

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

c = A("c")
n = B("n")
b = C("b")
l = C("l")
a = B("a")
d = A("d")
m = A("m")
g = A("g")
e = A("e")

c.z = m
c.q = b
c.s = d
n.t = g
n.u = a
b.o = l
b.y = l
b.s = d
l.o = b
l.y = b
l.s = e
a.t = g
a.u = n
d.z = m
d.q = l
d.s = g
m.z = d
m.s = d
m.q = l
g.z = c
g.q = b
g.s = m
e.z = d
e.q = l
e.s = m
assert e.s.q.o.txt == "b"