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

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

f = A("f")
a = B("a")
b = C("b")
m = D("m")
h = E("h")
i = A("i")

f.u = a
f.w = a
f.s = i
f.y = b
f.p = h
a.v = h
a.p = f
b.w = a
m.o = b
m.r = b
m.w = i
h.q = m
h.y = m
h.w = b
i.u = a
i.w = a
i.s = f
i.y = b
i.p = h
assert b.w.p.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: B = None
        self.s: A = None
        self.y: C = None
        self.p: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

f = A("f")
a = B("a")
b = C("b")
m = D("m")
h = E("h")
i = A("i")

f.u = a
f.w = a
f.s = i
f.y = b
f.p = h
a.v = h
a.p = f
b.w = a
m.o = b
m.r = b
m.w = i
h.q = m
h.y = m
h.w = b
i.u = a
i.w = a
i.s = f
i.y = b
i.p = h
assert b.w.p.p.q.txt == "m"