class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.t: H = None
        self.o: F = None
        self.q: F = None
        self.z: E = None
        self.v: E = None
        self.txt = txt

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

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.s: B = None
        self.y: B = None
        self.t: H = None
        self.o: F = None
        self.q: F = None
        self.z: E = None
        self.v: E = None
        self.txt = txt

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

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

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