class A:
    def __init__(self, txt: str):
        self.u: J = None
        self.s: C = None
        self.r: D = None
        self.p: C = None
        self.o: H = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.q: C = None
        self.y: F = None
        self.o: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: F = None
        self.p: I = None
        self.q: J = None
        self.x: I = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.p: I = None
        self.w: F = None
        self.z: C = None
        self.txt = txt

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

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

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

m.u = l
m.s = c
m.p = c
m.r = a
m.o = d
m.t = f
i.t = c
i.v = c
i.q = c
i.y = f
i.o = h
c.r = d
a.z = h
a.v = f
a.p = n
a.x = n
a.q = l
g.v = m
f.u = g
h.x = f
h.w = c
h.u = l
h.v = l
d.p = n
d.w = f
d.z = c
n.u = g
l.s = d
l.x = i
l.w = h
l.r = g
assert f.u.v.r.q.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: J = None
        self.s: C = None
        self.r: D = None
        self.p: C = None
        self.o: H = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.q: C = None
        self.y: F = None
        self.o: G = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.v: F = None
        self.p: I = None
        self.q: J = None
        self.x: I = None
        self.txt = txt

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

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

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

class H:
    def __init__(self, txt: str):
        self.p: I = None
        self.w: F = None
        self.z: C = None
        self.txt = txt

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

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

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

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