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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: E = None
        self.t: F = None
        self.o: E = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: F = None
        self.y: B = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: D = None
        self.v: C = None
        self.t: G = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: E = None
        self.w: F = None
        self.s: F = None
        self.p: A = None
        self.u: D = None
        self.txt = txt

d = A("d")
g = B("g")
i = C("i")
n = D("n")
h = E("h")
m = F("m")
a = G("a")
e = A("e")
j = B("j")

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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: E = None
        self.t: F = None
        self.o: E = None
        self.p: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: F = None
        self.y: B = None
        self.u: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.s: D = None
        self.v: C = None
        self.t: G = None
        self.r: B = None
        self.z: D = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.v: B = None
        self.z: E = None
        self.w: F = None
        self.s: F = None
        self.p: A = None
        self.u: D = None
        self.txt = txt

d = A("d")
g = B("g")
i = C("i")
n = D("n")
h = E("h")
m = F("m")
a = G("a")
e = A("e")
j = B("j")

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