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

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

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

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

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

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

h.w = n
h.t = f
h.x = c
h.z = c
n.o = h
n.x = f
n.s = e
n.t = m
n.p = c
m.z = n
m.t = e
m.q = e
c.t = f
c.y = j
c.s = d
e.r = n
f.w = n
f.t = h
f.x = c
f.z = j
j.t = f
j.y = c
j.s = m
i.z = n
i.t = e
i.q = e
d.z = n
d.t = e
d.q = e
assert f.t.w.s.r.s.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: A = None
        self.x: D = None
        self.z: D = None
        self.txt = txt

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

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

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

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

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

h.w = n
h.t = f
h.x = c
h.z = c
n.o = h
n.x = f
n.s = e
n.t = m
n.p = c
m.z = n
m.t = e
m.q = e
c.t = f
c.y = j
c.s = d
e.r = n
f.w = n
f.t = h
f.x = c
f.z = j
j.t = f
j.y = c
j.s = m
i.z = n
i.t = e
i.q = e
d.z = n
d.t = e
d.q = e
assert f.t.w.s.r.s.r.x.txt == "f"