class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: I = None
        self.v: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.p: C = None
        self.u: F = None
        self.x: G = None
        self.v: J = None
        self.r: I = None
        self.t: J = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: I = None
        self.u: C = None
        self.r: A = None
        self.q: D = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: J = None
        self.o: J = None
        self.v: A = None
        self.z: H = None
        self.r: I = None
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.o: G = None
        self.r: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: I = None
        self.z: C = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.p: H = None
        self.x: I = None
        self.v: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.z: F = None
        self.p: C = None
        self.u: F = None
        self.x: G = None
        self.v: J = None
        self.r: I = None
        self.t: J = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.v: I = None
        self.u: C = None
        self.r: A = None
        self.q: D = None
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: J = None
        self.o: J = None
        self.v: A = None
        self.z: H = None
        self.r: I = None
        self.p: A = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: G = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.o: G = None
        self.r: B = None
        self.txt = txt

class J:
    def __init__(self, txt: str):
        self.r: G = None
        self.q: I = None
        self.z: C = None
        self.s: C = None
        self.w: B = None
        self.txt = txt

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

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