class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: J = None
        self.t: I = None
        self.w: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: E = None
        self.w: H = None
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: J = None
        self.v: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: J = None
        self.o: D = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: A = None
        self.q: E = None
        self.txt = txt

n = A("n")
c = B("c")
i = C("i")
m = D("m")
e = E("e")
f = F("f")
h = G("h")
l = H("l")
k = I("k")
b = J("b")

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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: J = None
        self.t: I = None
        self.w: H = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: E = None
        self.w: H = None
        self.q: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.r: J = None
        self.v: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.x: J = None
        self.o: D = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.r: D = None
        self.y: A = None
        self.q: E = None
        self.txt = txt

n = A("n")
c = B("c")
i = C("i")
m = D("m")
e = E("e")
f = F("f")
h = G("h")
l = H("l")
k = I("k")
b = J("b")

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