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

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: E = None
        self.w: A = None
        self.t: F = None
        self.y: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: A = None
        self.q: A = None
        self.o: D = None
        self.p: C = None
        self.z: D = None
        self.txt = txt

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

a = A("a")
b = B("b")
k = C("k")
d = D("d")
n = E("n")
h = F("h")

a.z = n
b.y = a
b.z = d
b.u = h
k.q = b
k.r = n
k.w = a
k.y = a
k.t = h
d.s = a
n.x = k
n.p = k
n.y = a
n.q = a
n.o = d
n.z = d
h.x = a
assert d.s.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.r: E = None
        self.w: A = None
        self.t: F = None
        self.y: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: A = None
        self.q: A = None
        self.o: D = None
        self.p: C = None
        self.z: D = None
        self.txt = txt

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

a = A("a")
b = B("b")
k = C("k")
d = D("d")
n = E("n")
h = F("h")

a.z = n
b.y = a
b.z = d
b.u = h
k.q = b
k.r = n
k.w = a
k.y = a
k.t = h
d.s = a
n.x = k
n.p = k
n.y = a
n.q = a
n.o = d
n.z = d
h.x = a
assert d.s.z.o.txt == "d"