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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: D = None
        self.o: A = None
        self.t: C = None
        self.w: D = None
        self.y: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

e = A("e")
f = B("f")
h = C("h")
m = D("m")
g = E("g")
i = F("i")
b = G("b")

e.z = b
e.s = f
f.q = h
h.o = m
m.x = i
g.u = e
g.o = e
g.q = m
g.w = m
g.t = h
g.y = f
i.y = b
i.t = h
b.t = g
assert e.s.q.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.z: G = None
        self.s: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: D = None
        self.o: A = None
        self.t: C = None
        self.w: D = None
        self.y: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

e = A("e")
f = B("f")
h = C("h")
m = D("m")
g = E("g")
i = F("i")
b = G("b")

e.z = b
e.s = f
f.q = h
h.o = m
m.x = i
g.u = e
g.o = e
g.q = m
g.w = m
g.t = h
g.y = f
i.y = b
i.t = h
b.t = g
assert e.s.q.o.x.txt == "i"