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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: E = None
        self.s: D = None
        self.p: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: E = None
        self.y: A = None
        self.s: E = None
        self.u: E = None
        self.x: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: A = None
        self.y: E = None
        self.s: D = None
        self.p: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.t: E = None
        self.p: E = None
        self.y: A = None
        self.s: E = None
        self.u: E = None
        self.x: A = None
        self.txt = txt

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

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