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

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

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

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

l = A("l")
m = B("m")
g = C("g")
e = D("e")
k = D("k")
h = A("h")
i = B("i")
a = C("a")
b = B("b")

l.p = i
l.z = b
l.r = k
l.w = a
m.z = g
g.v = h
g.o = a
g.y = a
g.u = i
e.q = h
e.o = l
e.x = k
e.r = g
k.q = h
k.o = l
k.x = e
k.r = a
h.p = i
h.z = b
h.r = e
h.w = a
i.z = a
a.v = h
a.o = g
a.y = g
a.u = b
b.z = a
assert k.o.z.z.o.u.z.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.z: B = None
        self.r: D = None
        self.w: C = None
        self.txt = txt

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

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

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

l = A("l")
m = B("m")
g = C("g")
e = D("e")
k = D("k")
h = A("h")
i = B("i")
a = C("a")
b = B("b")

l.p = i
l.z = b
l.r = k
l.w = a
m.z = g
g.v = h
g.o = a
g.y = a
g.u = i
e.q = h
e.o = l
e.x = k
e.r = g
k.q = h
k.o = l
k.x = e
k.r = a
h.p = i
h.z = b
h.r = e
h.w = a
i.z = a
a.v = h
a.o = g
a.y = g
a.u = b
b.z = a
assert k.o.z.z.o.u.z.v.p.txt == "i"