class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: G = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

m = A("m")
j = B("j")
c = C("c")
g = D("g")
a = E("a")
h = F("h")
i = G("i")

m.o = a
m.w = i
m.q = h
j.t = c
j.q = a
c.u = a
c.w = a
g.o = i
a.o = g
a.p = g
h.s = i
h.x = c
i.z = g
assert a.o.o.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.w: G = None
        self.q: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: E = None
        self.w: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: G = None
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

m = A("m")
j = B("j")
c = C("c")
g = D("g")
a = E("a")
h = F("h")
i = G("i")

m.o = a
m.w = i
m.q = h
j.t = c
j.q = a
c.u = a
c.w = a
g.o = i
a.o = g
a.p = g
h.s = i
h.x = c
i.z = g
assert a.o.o.z.o.z.txt == "g"