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

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

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

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

i = A("i")
j = B("j")
n = C("n")
c = D("c")
l = D("l")
k = C("k")
d = B("d")
h = C("h")
e = C("e")

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

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

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

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

i = A("i")
j = B("j")
n = C("n")
c = D("c")
l = D("l")
k = C("k")
d = B("d")
h = C("h")
e = C("e")

i.u = l
i.v = h
j.v = d
n.s = e
n.t = l
n.u = c
n.r = d
c.x = l
c.o = l
l.x = c
l.o = c
k.s = e
k.t = l
k.u = c
k.r = d
d.v = j
h.s = e
h.t = l
h.u = l
h.r = j
e.s = h
e.t = c
e.u = l
e.r = d
assert d.v.v.v.v.v.txt == "j"