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

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

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

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

l = A("l")
b = B("b")
k = C("k")
d = D("d")
h = A("h")
j = C("j")
a = A("a")
m = B("m")
i = A("i")
c = D("c")

l.z = b
l.p = b
l.o = b
l.s = c
b.r = m
k.x = d
d.o = c
d.w = h
h.z = m
h.p = m
h.o = m
h.s = c
j.x = d
a.z = m
a.p = m
a.o = m
a.s = c
m.r = b
i.z = m
i.o = m
i.p = b
i.s = d
c.o = d
c.w = l
assert d.w.s.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.p: B = None
        self.o: B = None
        self.s: D = None
        self.txt = txt

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

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

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

l = A("l")
b = B("b")
k = C("k")
d = D("d")
h = A("h")
j = C("j")
a = A("a")
m = B("m")
i = A("i")
c = D("c")

l.z = b
l.p = b
l.o = b
l.s = c
b.r = m
k.x = d
d.o = c
d.w = h
h.z = m
h.p = m
h.o = m
h.s = c
j.x = d
a.z = m
a.p = m
a.o = m
a.s = c
m.r = b
i.z = m
i.o = m
i.p = b
i.s = d
c.o = d
c.w = l
assert d.w.s.o.o.txt == "c"