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

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

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

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

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

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

g.w = f
g.p = f
g.s = h
f.o = e
f.u = e
f.t = b
f.p = h
f.r = l
b.z = m
b.q = e
e.v = f
m.t = l
m.o = f
h.w = f
h.p = f
h.s = g
l.z = m
l.q = e
assert g.w.p.w.o.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.s: A = None
        self.p: B = None
        self.txt = txt

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

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

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

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

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

g.w = f
g.p = f
g.s = h
f.o = e
f.u = e
f.t = b
f.p = h
f.r = l
b.z = m
b.q = e
e.v = f
m.t = l
m.o = f
h.w = f
h.p = f
h.s = g
l.z = m
l.q = e
assert g.w.p.w.o.v.u.v.txt == "f"