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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: D = None
        self.q: F = None
        self.t: A = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.x: F = None
        self.p: F = None
        self.o: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: D = None
        self.q: F = None
        self.t: A = None
        self.y: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.x: F = None
        self.p: F = None
        self.o: A = None
        self.r: B = None
        self.txt = txt

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

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

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

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