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

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: B = None
        self.s: D = None
        self.txt = txt

g = A("g")
a = B("a")
l = C("l")
m = D("m")
b = A("b")
i = D("i")
c = A("c")
f = B("f")

g.p = i
g.y = a
g.w = b
a.o = l
a.p = l
a.s = l
a.z = i
l.t = g
l.u = b
m.z = f
m.u = a
m.s = i
b.p = m
b.y = f
b.w = g
i.z = f
i.u = a
i.s = m
c.p = i
c.y = a
c.w = g
f.o = l
f.p = l
f.s = l
f.z = m
assert m.u.s.t.y.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: B = None
        self.w: A = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.u: B = None
        self.s: D = None
        self.txt = txt

g = A("g")
a = B("a")
l = C("l")
m = D("m")
b = A("b")
i = D("i")
c = A("c")
f = B("f")

g.p = i
g.y = a
g.w = b
a.o = l
a.p = l
a.s = l
a.z = i
l.t = g
l.u = b
m.z = f
m.u = a
m.s = i
b.p = m
b.y = f
b.w = g
i.z = f
i.u = a
i.s = m
c.p = i
c.y = a
c.w = g
f.o = l
f.p = l
f.s = l
f.z = m
assert m.u.s.t.y.z.z.txt == "f"