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

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: C = None
        self.t: C = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

l = A("l")
d = B("d")
h = C("h")
j = D("j")
b = E("b")
e = D("e")
n = A("n")
f = E("f")
i = C("i")

l.q = i
l.u = n
d.u = n
d.x = n
d.r = b
d.v = f
h.q = f
h.y = i
h.t = i
h.z = i
h.r = d
j.s = l
j.v = i
b.x = j
e.s = l
e.v = h
n.q = h
n.u = l
f.x = e
i.q = f
i.y = h
i.t = h
i.z = h
i.r = d
assert f.x.s.u.u.u.u.u.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.u: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: E = None
        self.y: C = None
        self.t: C = None
        self.r: B = None
        self.z: C = None
        self.txt = txt

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

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

l = A("l")
d = B("d")
h = C("h")
j = D("j")
b = E("b")
e = D("e")
n = A("n")
f = E("f")
i = C("i")

l.q = i
l.u = n
d.u = n
d.x = n
d.r = b
d.v = f
h.q = f
h.y = i
h.t = i
h.z = i
h.r = d
j.s = l
j.v = i
b.x = j
e.s = l
e.v = h
n.q = h
n.u = l
f.x = e
i.q = f
i.y = h
i.t = h
i.z = h
i.r = d
assert f.x.s.u.u.u.u.u.q.r.txt == "d"