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

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: D = None
        self.txt = txt

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

l = A("l")
c = B("c")
d = C("d")
g = D("g")
f = B("f")
m = D("m")
j = C("j")
e = A("e")
h = B("h")
b = D("b")

l.p = f
l.z = f
l.o = f
c.o = b
c.w = l
c.t = l
c.q = g
d.y = l
d.z = m
g.o = d
f.o = g
f.q = g
f.w = l
f.t = e
m.o = j
j.y = e
j.z = b
e.p = c
e.z = f
e.o = h
h.o = g
h.w = l
h.t = e
h.q = b
b.o = j
assert m.o.z.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.o: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: A = None
        self.z: D = None
        self.txt = txt

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

l = A("l")
c = B("c")
d = C("d")
g = D("g")
f = B("f")
m = D("m")
j = C("j")
e = A("e")
h = B("h")
b = D("b")

l.p = f
l.z = f
l.o = f
c.o = b
c.w = l
c.t = l
c.q = g
d.y = l
d.z = m
g.o = d
f.o = g
f.q = g
f.w = l
f.t = e
m.o = j
j.y = e
j.z = b
e.p = c
e.z = f
e.o = h
h.o = g
h.w = l
h.t = e
h.q = b
b.o = j
assert m.o.z.o.z.txt == "b"