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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: E = None
        self.o: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: B = None
        self.txt = txt

d = A("d")
h = B("h")
j = C("j")
k = D("k")
f = E("f")
g = E("g")
i = B("i")
n = E("n")

d.o = f
d.t = j
d.r = j
d.p = h
h.u = d
h.v = n
h.o = n
j.o = k
j.x = k
j.s = k
j.v = n
k.o = h
f.r = n
f.x = h
g.r = f
g.x = h
i.u = d
i.v = g
i.o = n
n.r = g
n.x = i
assert n.r.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.t: C = None
        self.p: B = None
        self.r: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.v: E = None
        self.o: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: B = None
        self.txt = txt

d = A("d")
h = B("h")
j = C("j")
k = D("k")
f = E("f")
g = E("g")
i = B("i")
n = E("n")

d.o = f
d.t = j
d.r = j
d.p = h
h.u = d
h.v = n
h.o = n
j.o = k
j.x = k
j.s = k
j.v = n
k.o = h
f.r = n
f.x = h
g.r = f
g.x = h
i.u = d
i.v = g
i.o = n
n.r = g
n.x = i
assert n.r.x.o.txt == "n"