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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: A = None
        self.u: B = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: E = None
        self.v: A = None
        self.q: B = None
        self.txt = txt

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

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

h = A("h")
e = B("e")
k = C("k")
b = D("b")
m = E("m")
l = F("l")
f = B("f")

h.w = m
h.s = k
h.y = e
e.o = k
e.r = h
e.u = f
e.p = m
k.w = h
b.r = l
b.u = m
b.v = h
b.q = f
m.w = k
m.z = k
m.v = e
l.z = h
f.o = k
f.r = h
f.u = e
f.p = m
assert m.w.w.y.u.o.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: C = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.r: A = None
        self.u: B = None
        self.p: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: E = None
        self.v: A = None
        self.q: B = None
        self.txt = txt

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

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

h = A("h")
e = B("e")
k = C("k")
b = D("b")
m = E("m")
l = F("l")
f = B("f")

h.w = m
h.s = k
h.y = e
e.o = k
e.r = h
e.u = f
e.p = m
k.w = h
b.r = l
b.u = m
b.v = h
b.q = f
m.w = k
m.z = k
m.v = e
l.z = h
f.o = k
f.r = h
f.u = e
f.p = m
assert m.w.w.y.u.o.w.w.txt == "m"