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

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

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

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

h = A("h")
g = B("g")
n = C("n")
f = D("f")
a = D("a")
e = B("e")

h.o = a
h.v = a
h.r = a
h.u = n
g.x = a
g.y = h
g.p = f
g.z = n
n.y = h
n.o = g
f.x = a
f.u = g
f.t = e
f.q = n
a.x = f
a.u = g
a.t = g
a.q = n
e.x = a
e.y = h
e.p = f
e.z = n
assert h.r.u.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: D = None
        self.u: C = None
        self.r: D = None
        self.txt = txt

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

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

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

h = A("h")
g = B("g")
n = C("n")
f = D("f")
a = D("a")
e = B("e")

h.o = a
h.v = a
h.r = a
h.u = n
g.x = a
g.y = h
g.p = f
g.z = n
n.y = h
n.o = g
f.x = a
f.u = g
f.t = e
f.q = n
a.x = f
a.u = g
a.t = g
a.q = n
e.x = a
e.y = h
e.p = f
e.z = n
assert h.r.u.x.q.txt == "n"