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

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.u: J = None
        self.z: C = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: H = None
        self.w: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: D = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: H = None
        self.u: J = None
        self.z: C = None
        self.o: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.o: H = None
        self.w: F = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: D = None
        self.u: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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