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

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.y: C = None
        self.s: C = None
        self.txt = txt

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

h = A("h")
n = B("n")
j = C("j")
g = D("g")
d = D("d")
b = A("b")
l = C("l")
m = D("m")

h.x = l
h.p = j
n.q = l
n.z = h
j.o = l
j.z = l
j.y = l
j.s = l
g.t = n
g.r = l
g.q = l
g.p = h
d.t = n
d.r = l
d.q = j
d.p = h
b.x = j
b.p = l
l.o = j
l.z = j
l.y = j
l.s = j
m.t = n
m.r = j
m.q = l
m.p = b
assert h.p.y.s.o.y.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.z: C = None
        self.y: C = None
        self.s: C = None
        self.txt = txt

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

h = A("h")
n = B("n")
j = C("j")
g = D("g")
d = D("d")
b = A("b")
l = C("l")
m = D("m")

h.x = l
h.p = j
n.q = l
n.z = h
j.o = l
j.z = l
j.y = l
j.s = l
g.t = n
g.r = l
g.q = l
g.p = h
d.t = n
d.r = l
d.q = j
d.p = h
b.x = j
b.p = l
l.o = j
l.z = j
l.y = j
l.s = j
m.t = n
m.r = j
m.q = l
m.p = b
assert h.p.y.s.o.y.z.z.txt == "j"