class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.q: H = None
        self.v: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: G = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.t: C = None
        self.v: C = None
        self.p: H = None
        self.u: E = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: H = None
        self.x: E = None
        self.txt = txt

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

j = A("j")
a = B("a")
f = C("f")
n = D("n")
i = E("i")
b = F("b")
e = G("e")
d = H("d")

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.y: G = None
        self.w: A = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.t: C = None
        self.v: C = None
        self.p: H = None
        self.u: E = None
        self.s: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: H = None
        self.x: E = None
        self.txt = txt

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

j = A("j")
a = B("a")
f = C("f")
n = D("n")
i = E("i")
b = F("b")
e = G("e")
d = H("d")

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