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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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