class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: A = None
        self.w: D = None
        self.u: C = None
        self.txt = txt

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

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

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

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

g.x = f
g.w = f
g.o = l
g.u = m
n.s = a
m.z = c
a.p = b
a.w = f
a.v = n
h.s = f
c.s = a
f.p = h
f.w = a
f.v = c
b.s = f
l.x = f
l.w = f
l.o = g
l.u = m
assert c.s.w.v.s.p.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.o: A = None
        self.w: D = None
        self.u: C = None
        self.txt = txt

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

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

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

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

g.x = f
g.w = f
g.o = l
g.u = m
n.s = a
m.z = c
a.p = b
a.w = f
a.v = n
h.s = f
c.s = a
f.p = h
f.w = a
f.v = c
b.s = f
l.x = f
l.w = f
l.o = g
l.u = m
assert c.s.w.v.s.p.s.v.txt == "c"