class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.x: B = None
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.s: A = None
        self.r: B = None
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.s: A = None
        self.r: B = None
        self.y: A = None
        self.txt = txt

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

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

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

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