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

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

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

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

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

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

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

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

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

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

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