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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: B = None
        self.w: B = None
        self.s: D = None
        self.txt = txt

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

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

e.r = d
e.v = d
e.o = h
n.y = g
n.s = g
n.u = e
g.v = d
g.s = d
g.u = n
g.w = n
d.z = h
d.w = n
d.y = n
d.p = n
h.r = d
h.v = d
h.o = e
assert n.s.u.u.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.v: D = None
        self.o: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.u: B = None
        self.w: B = None
        self.s: D = None
        self.txt = txt

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

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

e.r = d
e.v = d
e.o = h
n.y = g
n.s = g
n.u = e
g.v = d
g.s = d
g.u = n
g.w = n
d.z = h
d.w = n
d.y = n
d.p = n
h.r = d
h.v = d
h.o = e
assert n.s.u.u.r.z.txt == "h"