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

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

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

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

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

c.x = a
c.z = m
c.o = n
c.u = l
n.p = m
n.y = c
b.p = f
b.u = a
b.x = l
b.t = j
j.u = f
j.z = n
f.p = h
f.y = c
e.x = b
e.z = c
e.o = n
e.u = j
a.p = n
a.u = b
a.x = l
a.t = j
m.x = b
m.z = e
m.o = n
m.u = j
l.u = f
l.z = n
h.x = b
h.z = c
h.o = n
h.u = j
assert j.u.p.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.z: A = None
        self.o: B = None
        self.u: D = None
        self.txt = txt

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

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

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

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

c.x = a
c.z = m
c.o = n
c.u = l
n.p = m
n.y = c
b.p = f
b.u = a
b.x = l
b.t = j
j.u = f
j.z = n
f.p = h
f.y = c
e.x = b
e.z = c
e.o = n
e.u = j
a.p = n
a.u = b
a.x = l
a.t = j
m.x = b
m.z = e
m.o = n
m.u = j
l.u = f
l.z = n
h.x = b
h.z = c
h.o = n
h.u = j
assert j.u.p.x.p.txt == "f"