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

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: B = None
        self.x: A = None
        self.s: D = None
        self.t: F = None
        self.txt = txt

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

k = A("k")
e = B("e")
d = C("d")
m = D("m")
a = E("a")
h = F("h")
j = D("j")

k.w = d
k.r = d
e.u = m
e.z = k
e.y = h
d.t = m
m.y = j
m.s = h
m.p = k
m.z = k
m.o = e
a.u = d
a.p = e
a.x = k
a.s = m
a.t = h
h.p = a
j.y = m
j.s = h
j.p = k
j.z = k
j.o = e
assert m.p.r.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.u: C = None
        self.p: B = None
        self.x: A = None
        self.s: D = None
        self.t: F = None
        self.txt = txt

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

k = A("k")
e = B("e")
d = C("d")
m = D("m")
a = E("a")
h = F("h")
j = D("j")

k.w = d
k.r = d
e.u = m
e.z = k
e.y = h
d.t = m
m.y = j
m.s = h
m.p = k
m.z = k
m.o = e
a.u = d
a.p = e
a.x = k
a.s = m
a.t = h
h.p = a
j.y = m
j.s = h
j.p = k
j.z = k
j.o = e
assert m.p.r.t.p.txt == "k"