class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.u: B = None
        self.w: B = None
        self.q: A = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

l.y = b
l.u = n
l.w = n
l.q = c
n.p = g
n.r = a
n.w = f
n.o = d
h.z = n
h.q = b
a.s = g
a.o = l
a.v = n
a.w = d
g.s = a
g.o = d
g.v = n
g.w = l
f.z = n
f.q = b
d.y = b
d.u = n
d.w = n
d.q = c
b.z = n
b.q = f
c.y = b
c.u = n
c.w = n
c.q = d
assert g.o.y.z.o.txt == "d"