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

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

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

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

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

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

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

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

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

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

e.p = l
h.o = e
h.x = d
a.w = g
b.v = h
b.t = e
m.v = h
m.t = e
g.w = a
l.o = f
l.x = b
d.v = h
d.t = f
f.p = h
j.w = a
assert l.x.t.p.x.t.p.o.p.o.txt == "e"