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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
c = C("c")
g = D("g")
l = E("l")
a = F("a")
j = G("j")
e = E("e")

m.q = e
m.x = b
b.z = m
b.o = l
b.w = c
b.p = c
c.y = e
g.o = b
g.r = b
g.z = c
l.t = g
a.u = c
a.y = c
a.s = j
a.t = l
a.x = e
a.z = m
a.w = b
j.u = m
e.t = g
assert a.s.u.x.z.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
c = C("c")
g = D("g")
l = E("l")
a = F("a")
j = G("j")
e = E("e")

m.q = e
m.x = b
b.z = m
b.o = l
b.w = c
b.p = c
c.y = e
g.o = b
g.r = b
g.z = c
l.t = g
a.u = c
a.y = c
a.s = j
a.t = l
a.x = e
a.z = m
a.w = b
j.u = m
e.t = g
assert a.s.u.x.z.txt == "m"