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

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

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

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

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

f.p = l
f.s = l
f.z = g
f.r = h
a.q = b
a.o = f
a.s = l
a.z = g
g.u = h
l.w = e
l.v = e
l.z = g
h.q = f
h.o = b
h.s = l
h.z = g
b.p = l
b.s = l
b.z = g
b.r = a
e.q = f
e.o = f
e.s = l
e.z = g
assert h.z.u.s.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: D = None
        self.z: C = None
        self.r: B = None
        self.txt = txt

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

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

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

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

f.p = l
f.s = l
f.z = g
f.r = h
a.q = b
a.o = f
a.s = l
a.z = g
g.u = h
l.w = e
l.v = e
l.z = g
h.q = f
h.o = b
h.s = l
h.z = g
b.p = l
b.s = l
b.z = g
b.r = a
e.q = f
e.o = f
e.s = l
e.z = g
assert h.z.u.s.z.txt == "g"