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

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

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

i = A("i")
g = B("g")
b = C("b")
c = C("c")
h = B("h")
f = A("f")
n = C("n")
d = A("d")
m = B("m")

i.o = b
i.r = c
i.q = c
g.o = f
g.z = m
b.o = m
b.v = c
b.w = n
c.o = g
c.v = b
c.w = b
h.o = f
h.z = m
f.o = b
f.r = n
f.q = c
n.o = g
n.v = c
n.w = c
d.o = c
d.r = c
d.q = c
m.o = i
m.z = h
assert g.z.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: C = None
        self.q: C = None
        self.txt = txt

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

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

i = A("i")
g = B("g")
b = C("b")
c = C("c")
h = B("h")
f = A("f")
n = C("n")
d = A("d")
m = B("m")

i.o = b
i.r = c
i.q = c
g.o = f
g.z = m
b.o = m
b.v = c
b.w = n
c.o = g
c.v = b
c.w = b
h.o = f
h.z = m
f.o = b
f.r = n
f.q = c
n.o = g
n.v = c
n.w = c
d.o = c
d.r = c
d.q = c
m.o = i
m.z = h
assert g.z.o.o.txt == "b"