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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: H = None
        self.y: G = None
        self.z: I = None
        self.r: G = None
        self.w: J = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: J = None
        self.txt = txt

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

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

class J:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: H = None
        self.o: I = None
        self.v: I = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.t: H = None
        self.y: G = None
        self.z: I = None
        self.r: G = None
        self.w: J = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: E = None
        self.w: J = None
        self.txt = txt

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

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

class J:
    def __init__(self, txt: str):
        self.u: H = None
        self.x: H = None
        self.o: I = None
        self.v: I = None
        self.y: C = None
        self.txt = txt

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

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