class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: G = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: A = None
        self.z: H = None
        self.p: C = None
        self.o: D = None
        self.q: D = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: C = None
        self.o: F = None
        self.txt = txt

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

k = A("k")
j = B("j")
d = C("d")
i = D("i")
m = E("m")
e = F("e")
a = G("a")
c = H("c")

k.y = m
k.v = a
k.p = i
j.r = i
j.q = i
j.z = i
d.w = m
i.w = c
i.x = j
i.s = j
m.r = j
m.y = k
m.z = c
m.p = d
m.o = i
m.q = i
m.v = e
e.v = c
e.y = d
a.z = j
a.x = d
a.o = e
c.x = j
assert c.x.z.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: G = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: A = None
        self.z: H = None
        self.p: C = None
        self.o: D = None
        self.q: D = None
        self.v: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: H = None
        self.y: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: B = None
        self.x: C = None
        self.o: F = None
        self.txt = txt

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

k = A("k")
j = B("j")
d = C("d")
i = D("i")
m = E("m")
e = F("e")
a = G("a")
c = H("c")

k.y = m
k.v = a
k.p = i
j.r = i
j.q = i
j.z = i
d.w = m
i.w = c
i.x = j
i.s = j
m.r = j
m.y = k
m.z = c
m.p = d
m.o = i
m.q = i
m.v = e
e.v = c
e.y = d
a.z = j
a.x = d
a.o = e
c.x = j
assert c.x.z.w.txt == "c"