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

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

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

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

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

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

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

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

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

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

j.p = k
j.o = f
k.v = a
k.p = j
k.z = b
k.w = c
a.x = k
g.r = j
g.p = c
g.v = k
h.p = e
h.o = f
b.r = h
b.p = a
b.v = e
l.x = k
f.p = e
f.o = h
c.x = k
e.v = c
e.w = c
e.p = f
e.z = g
assert k.z.r.p.v.x.v.x.txt == "k"