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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: A = None
        self.o: B = None
        self.x: C = None
        self.txt = txt

f = A("f")
e = B("e")
h = C("h")
k = D("k")
a = E("a")
m = B("m")

f.u = k
e.w = m
e.o = m
e.u = k
e.t = h
e.v = f
h.o = m
h.q = a
h.x = e
k.v = e
k.x = f
a.s = k
a.q = f
a.o = m
a.x = h
m.w = e
m.o = e
m.u = k
m.t = h
m.v = f
assert f.u.v.v.u.v.t.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.q: A = None
        self.o: B = None
        self.x: C = None
        self.txt = txt

f = A("f")
e = B("e")
h = C("h")
k = D("k")
a = E("a")
m = B("m")

f.u = k
e.w = m
e.o = m
e.u = k
e.t = h
e.v = f
h.o = m
h.q = a
h.x = e
k.v = e
k.x = f
a.s = k
a.q = f
a.o = m
a.x = h
m.w = e
m.o = e
m.u = k
m.t = h
m.v = f
assert f.u.v.v.u.v.t.txt == "h"