class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: D = None
        self.w: C = None
        self.y: D = None
        self.txt = txt

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

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

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

a.x = h
l.y = c
l.w = c
l.t = e
l.u = e
l.q = m
l.o = m
c.s = g
c.u = a
c.y = a
e.s = m
h.r = c
h.w = c
h.t = e
h.y = e
m.r = e
m.z = g
g.y = e
g.t = e
g.u = c
g.o = h
assert a.x.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: D = None
        self.w: C = None
        self.y: D = None
        self.txt = txt

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

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

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

a.x = h
l.y = c
l.w = c
l.t = e
l.u = e
l.q = m
l.o = m
c.s = g
c.u = a
c.y = a
e.s = m
h.r = c
h.w = c
h.t = e
h.y = e
m.r = e
m.z = g
g.y = e
g.t = e
g.u = c
g.o = h
assert a.x.w.s.txt == "g"