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

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: C = None
        self.v: H = None
        self.o: A = None
        self.q: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

n = A("n")
d = B("d")
c = C("c")
e = D("e")
m = E("m")
a = F("a")
j = G("j")
k = H("k")
i = I("i")

n.x = c
n.v = m
d.x = n
d.o = n
d.p = c
d.v = k
d.q = a
c.y = m
c.q = j
c.r = e
c.z = e
c.x = k
c.p = n
e.u = n
m.o = n
a.p = k
j.p = a
j.w = c
k.x = j
i.p = a
assert i.p.p.x.p.p.x.w.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: C = None
        self.v: H = None
        self.o: A = None
        self.q: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

n = A("n")
d = B("d")
c = C("c")
e = D("e")
m = E("m")
a = F("a")
j = G("j")
k = H("k")
i = I("i")

n.x = c
n.v = m
d.x = n
d.o = n
d.p = c
d.v = k
d.q = a
c.y = m
c.q = j
c.r = e
c.z = e
c.x = k
c.p = n
e.u = n
m.o = n
a.p = k
j.p = a
j.w = c
k.x = j
i.p = a
assert i.p.p.x.p.p.x.w.p.txt == "n"