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

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

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

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

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

j = A("j")
b = B("b")
f = C("f")
d = D("d")
h = E("h")
n = C("n")
a = D("a")

j.v = a
b.o = a
b.r = d
f.q = d
f.v = n
f.u = a
f.t = j
d.r = h
d.o = h
h.s = a
n.q = a
n.u = a
n.v = f
n.t = j
a.r = h
a.o = h
assert h.s.o.s.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.txt = txt

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

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

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

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

j = A("j")
b = B("b")
f = C("f")
d = D("d")
h = E("h")
n = C("n")
a = D("a")

j.v = a
b.o = a
b.r = d
f.q = d
f.v = n
f.u = a
f.t = j
d.r = h
d.o = h
h.s = a
n.q = a
n.u = a
n.v = f
n.t = j
a.r = h
a.o = h
assert h.s.o.s.r.txt == "h"