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

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

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

g = A("g")
l = B("l")
d = C("d")
j = B("j")
c = B("c")
n = C("n")
b = B("b")
f = C("f")

g.q = d
g.o = b
g.s = n
l.z = g
l.v = g
d.u = g
d.v = g
j.z = g
j.v = g
c.z = g
c.v = g
n.u = g
n.v = g
b.z = g
b.v = g
f.u = g
f.v = g
assert g.q.u.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.o: B = None
        self.s: C = None
        self.txt = txt

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

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

g = A("g")
l = B("l")
d = C("d")
j = B("j")
c = B("c")
n = C("n")
b = B("b")
f = C("f")

g.q = d
g.o = b
g.s = n
l.z = g
l.v = g
d.u = g
d.v = g
j.z = g
j.v = g
c.z = g
c.v = g
n.u = g
n.v = g
b.z = g
b.v = g
f.u = g
f.v = g
assert g.q.u.o.txt == "b"