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

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

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

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

k = A("k")
l = B("l")
j = C("j")
d = D("d")
f = A("f")
e = D("e")
m = C("m")

k.p = f
k.o = e
k.z = e
l.p = k
l.x = k
l.u = e
l.v = f
j.p = l
j.y = l
j.v = m
j.t = e
d.o = f
d.x = f
f.p = k
f.o = d
f.z = d
e.o = f
e.x = k
m.p = l
m.y = l
m.v = j
m.t = d
assert j.y.u.o.z.o.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: D = None
        self.z: D = None
        self.txt = txt

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

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

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

k = A("k")
l = B("l")
j = C("j")
d = D("d")
f = A("f")
e = D("e")
m = C("m")

k.p = f
k.o = e
k.z = e
l.p = k
l.x = k
l.u = e
l.v = f
j.p = l
j.y = l
j.v = m
j.t = e
d.o = f
d.x = f
f.p = k
f.o = d
f.z = d
e.o = f
e.x = k
m.p = l
m.y = l
m.v = j
m.t = d
assert j.y.u.o.z.o.p.z.txt == "e"