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

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

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

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

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

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

i.o = m
a.w = l
a.p = i
e.x = j
e.w = b
e.p = h
m.v = j
f.r = h
f.x = e
f.t = b
f.o = a
f.s = l
j.v = m
h.o = j
b.r = i
b.x = e
b.t = f
b.o = l
b.s = a
l.w = a
l.p = h
assert f.o.w.w.p.o.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

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

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

i.o = m
a.w = l
a.p = i
e.x = j
e.w = b
e.p = h
m.v = j
f.r = h
f.x = e
f.t = b
f.o = a
f.s = l
j.v = m
h.o = j
b.r = i
b.x = e
b.t = f
b.o = l
b.s = a
l.w = a
l.p = h
assert f.o.w.w.p.o.v.txt == "j"