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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: E = None
        self.r: E = None
        self.s: A = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: A = None
        self.z: C = None
        self.w: C = None
        self.txt = txt

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

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

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

i = A("i")
k = B("k")
h = C("h")
e = D("e")
a = E("a")
g = F("g")
m = G("m")
d = B("d")

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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.v: E = None
        self.r: E = None
        self.s: A = None
        self.x: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: F = None
        self.u: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: F = None
        self.r: A = None
        self.z: C = None
        self.w: C = None
        self.txt = txt

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

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

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

i = A("i")
k = B("k")
h = C("h")
e = D("e")
a = E("a")
g = F("g")
m = G("m")
d = B("d")

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