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

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

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

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

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

l.p = g
l.o = i
l.y = i
l.z = h
i.u = d
i.x = d
i.t = d
i.o = m
c.v = e
c.w = g
c.p = d
c.o = d
m.p = c
g.p = l
g.z = l
g.o = i
g.y = i
d.u = i
d.x = i
d.t = i
d.o = j
e.v = c
e.w = h
e.p = d
e.o = i
n.p = h
n.z = h
n.o = i
n.y = i
h.p = n
h.o = d
h.y = d
h.z = g
j.p = c
assert e.v.o.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: B = None
        self.y: B = None
        self.z: A = None
        self.txt = txt

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

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

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

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

l.p = g
l.o = i
l.y = i
l.z = h
i.u = d
i.x = d
i.t = d
i.o = m
c.v = e
c.w = g
c.p = d
c.o = d
m.p = c
g.p = l
g.z = l
g.o = i
g.y = i
d.u = i
d.x = i
d.t = i
d.o = j
e.v = c
e.w = h
e.p = d
e.o = i
n.p = h
n.z = h
n.o = i
n.y = i
h.p = n
h.o = d
h.y = d
h.z = g
j.p = c
assert e.v.o.o.p.txt == "c"