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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: A = None
        self.p: D = None
        self.z: G = None
        self.t: D = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: E = None
        self.r: A = None
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: F = None
        self.s: D = None
        self.w: B = None
        self.t: A = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.s: A = None
        self.p: D = None
        self.z: G = None
        self.t: D = None
        self.u: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.s: E = None
        self.r: A = None
        self.w: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: F = None
        self.s: D = None
        self.w: B = None
        self.t: A = None
        self.o: D = None
        self.r: A = None
        self.txt = txt

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

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