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

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

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

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

b = A("b")
h = B("h")
g = C("g")
e = D("e")
d = C("d")
c = A("c")
l = C("l")
i = B("i")
m = C("m")
j = B("j")

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

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

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

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

b = A("b")
h = B("h")
g = C("g")
e = D("e")
d = C("d")
c = A("c")
l = C("l")
i = B("i")
m = C("m")
j = B("j")

b.t = e
b.r = e
b.o = c
h.p = i
h.o = e
h.v = j
g.r = d
g.x = e
e.w = j
e.x = b
e.y = l
e.s = h
d.r = g
d.x = e
c.t = e
c.r = e
c.o = b
l.r = m
l.x = e
i.p = h
i.o = e
i.v = j
m.r = d
m.x = e
j.p = h
j.v = h
j.o = e
assert e.s.v.o.w.v.o.w.p.o.txt == "e"