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

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.r: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: G = None
        self.r: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.r: B = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: G = None
        self.r: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.o: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: F = None
        self.txt = txt

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

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