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

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: A = None
        self.y: A = None
        self.x: A = None
        self.u: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: G = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: A = None
        self.y: A = None
        self.x: A = None
        self.u: D = None
        self.txt = txt

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

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