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

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

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

class D:
    def __init__(self, txt: str):
        self.r: I = None
        self.p: J = None
        self.v: A = None
        self.s: E = None
        self.w: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: D = None
        self.o: A = None
        self.z: C = None
        self.s: F = None
        self.y: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.x: D = None
        self.u: F = None
        self.p: F = None
        self.t: F = None
        self.z: H = None
        self.r: I = None
        self.s: B = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: J = None
        self.q: J = None
        self.p: A = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: I = None
        self.p: J = None
        self.v: A = None
        self.s: E = None
        self.w: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.r: D = None
        self.o: A = None
        self.z: C = None
        self.s: F = None
        self.y: J = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.x: D = None
        self.u: F = None
        self.p: F = None
        self.t: F = None
        self.z: H = None
        self.r: I = None
        self.s: B = None
        self.txt = txt

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

class I:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: J = None
        self.q: J = None
        self.p: A = None
        self.u: F = None
        self.txt = txt

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

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

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