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

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

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

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

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

l.p = k
l.y = k
l.q = j
l.z = h
j.x = h
j.y = h
j.o = m
j.p = l
m.p = j
m.s = k
c.o = j
h.x = j
h.y = j
h.o = m
h.p = l
f.o = h
i.o = h
k.p = l
k.y = l
k.q = j
k.z = j
d.o = j
assert c.o.o.p.o.s.y.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: B = None
        self.z: B = None
        self.y: A = None
        self.txt = txt

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

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

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

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

l.p = k
l.y = k
l.q = j
l.z = h
j.x = h
j.y = h
j.o = m
j.p = l
m.p = j
m.s = k
c.o = j
h.x = j
h.y = j
h.o = m
h.p = l
f.o = h
i.o = h
k.p = l
k.y = l
k.q = j
k.z = j
d.o = j
assert c.o.o.p.o.s.y.z.txt == "h"