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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: D = None
        self.x: E = None
        self.s: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: G = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: D = None
        self.x: E = None
        self.s: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: G = None
        self.txt = txt

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

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

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

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