class A:
    def __init__(self, txt: str):
        self.s: E = None
        self.q: D = None
        self.w: D = None
        self.p: D = None
        self.y: F = None
        self.x: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.x: F = None
        self.r: F = None
        self.o: C = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.y: C = None
        self.txt = txt

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

m = A("m")
b = B("b")
h = C("h")
g = D("g")
d = E("d")
n = F("n")
a = B("a")

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.x: F = None
        self.r: F = None
        self.o: C = None
        self.s: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.y: C = None
        self.txt = txt

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

m = A("m")
b = B("b")
h = C("h")
g = D("g")
d = E("d")
n = F("n")
a = B("a")

m.s = d
m.q = g
m.w = g
m.p = g
m.y = n
m.x = n
b.o = g
b.p = d
h.s = g
g.z = h
g.q = h
g.o = h
g.s = h
g.x = n
g.r = n
d.z = m
d.p = a
d.y = h
n.x = m
a.o = g
a.p = d
assert a.o.r.x.w.txt == "g"