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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: B = None
        self.v: D = None
        self.u: H = None
        self.q: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: A = None
        self.z: G = None
        self.v: H = None
        self.u: C = None
        self.y: A = None
        self.s: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: B = None
        self.v: D = None
        self.u: H = None
        self.q: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.q: A = None
        self.z: G = None
        self.v: H = None
        self.u: C = None
        self.y: A = None
        self.s: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: C = None
        self.s: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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