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

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

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

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

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

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

b.t = j
b.o = f
i.u = e
i.v = f
i.q = h
g.o = h
h.z = e
j.v = a
j.t = f
j.y = f
j.u = g
e.t = j
e.o = i
a.t = d
a.o = i
f.u = e
f.v = i
f.q = h
d.v = e
d.t = f
d.y = f
d.u = g
assert f.u.t.u.o.z.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.o: B = None
        self.txt = txt

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

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

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

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

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

b.t = j
b.o = f
i.u = e
i.v = f
i.q = h
g.o = h
h.z = e
j.v = a
j.t = f
j.y = f
j.u = g
e.t = j
e.o = i
a.t = d
a.o = i
f.u = e
f.v = i
f.q = h
d.v = e
d.t = f
d.y = f
d.u = g
assert f.u.t.u.o.z.t.y.txt == "f"