class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.z: E = None
        self.r: G = None
        self.t: B = None
        self.w: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: E = None
        self.u: D = None
        self.y: E = None
        self.w: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: F = None
        self.y: E = None
        self.o: C = None
        self.txt = txt

n = A("n")
g = B("g")
l = C("l")
a = D("a")
h = E("h")
f = F("f")
e = G("e")

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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: E = None
        self.u: D = None
        self.y: E = None
        self.w: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.r: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: F = None
        self.x: F = None
        self.y: E = None
        self.o: C = None
        self.txt = txt

n = A("n")
g = B("g")
l = C("l")
a = D("a")
h = E("h")
f = F("f")
e = G("e")

n.q = g
n.t = g
n.z = h
n.r = e
n.w = e
g.s = a
g.u = a
g.w = a
g.o = h
g.y = h
l.o = n
l.q = f
l.y = f
l.p = h
l.x = g
l.w = a
l.s = a
a.x = e
a.w = h
a.z = h
h.y = a
h.w = f
h.x = n
f.w = n
f.y = l
f.r = e
e.w = f
e.x = f
e.y = h
e.o = l
assert l.p.x.r.txt == "e"