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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: F = None
        self.q: A = None
        self.x: A = None
        self.y: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.s: F = None
        self.q: A = None
        self.x: A = None
        self.y: A = None
        self.o: C = None
        self.txt = txt

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

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

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

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