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

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

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

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

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

h = A("h")
a = B("a")
d = C("d")
e = D("e")
n = E("n")
k = A("k")
j = C("j")

h.r = d
h.o = e
a.x = n
d.o = a
d.s = j
e.o = h
n.v = j
n.t = j
n.y = k
n.x = k
k.r = j
k.o = e
j.o = a
j.s = d
assert n.y.o.o.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.txt = txt

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

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

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

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

h = A("h")
a = B("a")
d = C("d")
e = D("e")
n = E("n")
k = A("k")
j = C("j")

h.r = d
h.o = e
a.x = n
d.o = a
d.s = j
e.o = h
n.v = j
n.t = j
n.y = k
n.x = k
k.r = j
k.o = e
j.o = a
j.s = d
assert n.y.o.o.r.txt == "d"