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

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: A = None
        self.o: C = None
        self.p: G = None
        self.w: B = None
        self.r: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: E = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: A = None
        self.o: C = None
        self.p: G = None
        self.w: B = None
        self.r: G = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.q: E = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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