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

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

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

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

g = A("g")
l = B("l")
n = C("n")
j = D("j")
d = B("d")
h = A("h")
a = B("a")
f = A("f")

g.p = f
g.x = h
g.y = j
l.o = g
l.x = n
l.p = n
n.s = j
j.v = d
j.z = n
j.y = f
d.o = f
d.x = n
d.p = n
h.p = f
h.x = f
h.y = j
a.o = h
a.x = n
a.p = n
f.p = g
f.x = h
f.y = j
assert h.x.y.z.s.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.y: D = None
        self.txt = txt

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

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

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

g = A("g")
l = B("l")
n = C("n")
j = D("j")
d = B("d")
h = A("h")
a = B("a")
f = A("f")

g.p = f
g.x = h
g.y = j
l.o = g
l.x = n
l.p = n
n.s = j
j.v = d
j.z = n
j.y = f
d.o = f
d.x = n
d.p = n
h.p = f
h.x = f
h.y = j
a.o = h
a.x = n
a.p = n
f.p = g
f.x = h
f.y = j
assert h.x.y.z.s.y.x.txt == "h"