class A:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: G = None
        self.u: J = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: I = None
        self.o: E = None
        self.s: F = None
        self.u: G = None
        self.r: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.w: I = None
        self.s: F = None
        self.t: I = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: J = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.x: I = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: I = None
        self.o: E = None
        self.s: F = None
        self.u: G = None
        self.r: A = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: H = None
        self.w: I = None
        self.s: F = None
        self.t: I = None
        self.r: C = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: G = None
        self.r: J = None
        self.txt = txt

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

class J:
    def __init__(self, txt: str):
        self.x: I = None
        self.txt = txt

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

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