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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: G = None
        self.z: B = None
        self.u: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: I = None
        self.u: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.u: C = None
        self.r: H = None
        self.x: I = None
        self.y: E = None
        self.v: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: A = None
        self.y: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: H = None
        self.u: A = None
        self.x: A = None
        self.v: B = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.w: G = None
        self.z: B = None
        self.u: H = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: I = None
        self.u: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: H = None
        self.u: C = None
        self.r: H = None
        self.x: I = None
        self.y: E = None
        self.v: F = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.s: A = None
        self.q: A = None
        self.y: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.r: H = None
        self.u: A = None
        self.x: A = None
        self.v: B = None
        self.txt = txt

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

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