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

class B:
    def __init__(self, txt: str):
        self.o: J = None
        self.p: A = None
        self.x: E = None
        self.t: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: G = None
        self.x: A = None
        self.s: J = None
        self.y: J = None
        self.p: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: A = None
        self.u: J = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.y: H = None
        self.r: G = None
        self.p: H = None
        self.q: D = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: J = None
        self.p: A = None
        self.x: E = None
        self.t: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: G = None
        self.x: A = None
        self.s: J = None
        self.y: J = None
        self.p: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: A = None
        self.u: J = None
        self.x: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: D = None
        self.s: B = None
        self.y: H = None
        self.r: G = None
        self.p: H = None
        self.q: D = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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