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

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

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

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

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

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

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

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

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

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

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

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

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