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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

k.w = j
k.r = j
k.s = i
b.t = i
b.w = n
b.z = k
h.x = b
m.u = i
f.o = k
f.u = k
j.r = k
j.q = m
j.w = h
i.o = k
i.u = c
n.x = b
c.w = j
c.r = j
c.s = i
e.u = i
assert m.u.o.s.u.s.o.w.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.s: E = None
        self.r: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

k.w = j
k.r = j
k.s = i
b.t = i
b.w = n
b.z = k
h.x = b
m.u = i
f.o = k
f.u = k
j.r = k
j.q = m
j.w = h
i.o = k
i.u = c
n.x = b
c.w = j
c.r = j
c.s = i
e.u = i
assert m.u.o.s.u.s.o.w.r.txt == "k"