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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: H = None
        self.u: G = None
        self.o: C = None
        self.q: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.p: F = None
        self.x: D = None
        self.y: D = None
        self.q: A = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.y: H = None
        self.u: G = None
        self.o: C = None
        self.q: A = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: A = None
        self.z: A = None
        self.p: F = None
        self.x: D = None
        self.y: D = None
        self.q: A = None
        self.u: D = None
        self.v: D = None
        self.txt = txt

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

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