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

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

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

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

l = A("l")
c = B("c")
k = C("k")
d = D("d")
j = A("j")
m = C("m")
g = D("g")
n = C("n")

l.p = g
c.o = k
c.x = g
c.z = l
c.u = j
k.p = d
k.o = c
k.u = m
k.w = j
d.y = c
j.p = g
m.p = g
m.o = c
m.u = n
m.w = l
g.y = c
n.p = g
n.o = c
n.u = k
n.w = j
assert m.p.y.x.y.x.y.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

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

l = A("l")
c = B("c")
k = C("k")
d = D("d")
j = A("j")
m = C("m")
g = D("g")
n = C("n")

l.p = g
c.o = k
c.x = g
c.z = l
c.u = j
k.p = d
k.o = c
k.u = m
k.w = j
d.y = c
j.p = g
m.p = g
m.o = c
m.u = n
m.w = l
g.y = c
n.p = g
n.o = c
n.u = k
n.w = j
assert m.p.y.x.y.x.y.u.p.txt == "g"