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

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.v: E = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: H = None
        self.u: G = None
        self.p: I = None
        self.t: G = None
        self.o: B = None
        self.q: D = None
        self.z: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: F = None
        self.y: B = None
        self.r: H = None
        self.o: I = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
b = C("b")
m = D("m")
f = E("f")
j = F("j")
c = G("c")
l = H("l")
k = I("k")

n.r = g
g.x = b
b.p = m
m.z = j
m.y = j
m.v = f
f.y = n
f.w = l
f.u = c
f.t = c
f.p = k
f.o = g
f.q = m
f.z = j
j.r = k
j.y = m
c.p = g
c.y = g
c.u = j
c.r = l
c.o = k
l.p = j
l.q = b
k.q = m
k.r = c
assert n.r.x.p.v.o.x.p.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.v: E = None
        self.y: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: H = None
        self.u: G = None
        self.p: I = None
        self.t: G = None
        self.o: B = None
        self.q: D = None
        self.z: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: B = None
        self.u: F = None
        self.y: B = None
        self.r: H = None
        self.o: I = None
        self.txt = txt

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

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

n = A("n")
g = B("g")
b = C("b")
m = D("m")
f = E("f")
j = F("j")
c = G("c")
l = H("l")
k = I("k")

n.r = g
g.x = b
b.p = m
m.z = j
m.y = j
m.v = f
f.y = n
f.w = l
f.u = c
f.t = c
f.p = k
f.o = g
f.q = m
f.z = j
j.r = k
j.y = m
c.p = g
c.y = g
c.u = j
c.r = l
c.o = k
l.p = j
l.q = b
k.q = m
k.r = c
assert n.r.x.p.v.o.x.p.y.r.txt == "k"