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

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

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

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

f = A("f")
k = B("k")
b = C("b")
a = D("a")
i = C("i")
n = B("n")
l = D("l")
h = C("h")
c = A("c")
j = B("j")

f.z = h
f.x = b
f.y = c
k.u = f
k.r = c
k.z = l
b.o = i
b.q = l
b.w = h
b.p = k
a.w = h
a.z = h
a.x = f
i.o = h
i.w = h
i.q = a
i.p = k
n.u = c
n.r = f
n.z = a
l.w = i
l.x = c
l.z = b
h.o = i
h.w = i
h.q = l
h.p = k
c.z = h
c.x = h
c.y = f
j.u = f
j.r = f
j.z = l
assert a.x.x.w.p.u.x.q.w.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.x: C = None
        self.y: A = None
        self.txt = txt

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

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

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

f = A("f")
k = B("k")
b = C("b")
a = D("a")
i = C("i")
n = B("n")
l = D("l")
h = C("h")
c = A("c")
j = B("j")

f.z = h
f.x = b
f.y = c
k.u = f
k.r = c
k.z = l
b.o = i
b.q = l
b.w = h
b.p = k
a.w = h
a.z = h
a.x = f
i.o = h
i.w = h
i.q = a
i.p = k
n.u = c
n.r = f
n.z = a
l.w = i
l.x = c
l.z = b
h.o = i
h.w = i
h.q = l
h.p = k
c.z = h
c.x = h
c.y = f
j.u = f
j.r = f
j.z = l
assert a.x.x.w.p.u.x.q.w.o.txt == "h"