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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: A = None
        self.o: A = None
        self.t: F = None
        self.w: F = None
        self.z: B = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: F = None
        self.y: F = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: D = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.x: A = None
        self.o: A = None
        self.t: F = None
        self.w: F = None
        self.z: B = None
        self.r: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: F = None
        self.y: F = None
        self.v: C = None
        self.z: C = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: D = None
        self.txt = txt

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

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

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