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

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: D = None
        self.t: A = None
        self.s: E = None
        self.y: E = None
        self.z: G = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: G = None
        self.q: A = None
        self.s: B = None
        self.o: A = None
        self.w: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.p: G = None
        self.r: D = None
        self.t: A = None
        self.s: E = None
        self.y: E = None
        self.z: G = None
        self.txt = txt

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.u: B = None
        self.z: G = None
        self.q: A = None
        self.s: B = None
        self.o: A = None
        self.w: B = None
        self.txt = txt

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

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