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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: B = None
        self.w: C = None
        self.txt = txt

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

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

k = A("k")
g = B("g")
j = C("j")
m = D("m")
h = E("h")
n = F("n")
e = C("e")

k.w = n
g.o = k
g.u = n
g.y = n
g.v = n
j.v = g
j.p = m
j.q = k
j.r = k
j.y = e
m.o = g
m.z = g
m.w = j
h.q = m
h.p = m
n.r = h
n.y = k
n.o = k
n.t = g
n.z = e
e.v = g
e.p = m
e.q = k
e.r = k
e.y = j
assert m.w.y.v.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.z: B = None
        self.w: C = None
        self.txt = txt

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

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

k = A("k")
g = B("g")
j = C("j")
m = D("m")
h = E("h")
n = F("n")
e = C("e")

k.w = n
g.o = k
g.u = n
g.y = n
g.v = n
j.v = g
j.p = m
j.q = k
j.r = k
j.y = e
m.o = g
m.z = g
m.w = j
h.q = m
h.p = m
n.r = h
n.y = k
n.o = k
n.t = g
n.z = e
e.v = g
e.p = m
e.q = k
e.r = k
e.y = j
assert m.w.y.v.o.w.txt == "n"