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

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

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

b = A("b")
n = B("n")
f = C("f")
i = B("i")
j = A("j")
c = C("c")
g = B("g")
k = A("k")
l = A("l")
e = A("e")

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

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

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

b = A("b")
n = B("n")
f = C("f")
i = B("i")
j = A("j")
c = C("c")
g = B("g")
k = A("k")
l = A("l")
e = A("e")

b.q = i
b.u = f
b.y = c
n.q = k
n.r = f
n.z = f
f.q = c
f.y = j
i.q = l
i.r = f
i.z = f
j.q = i
j.u = f
j.y = f
c.q = f
c.y = k
g.q = k
g.r = f
g.z = f
k.q = g
k.u = f
k.y = f
l.q = i
l.u = f
l.y = c
e.q = i
e.u = f
e.y = f
assert i.z.q.y.u.q.q.q.txt == "c"