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

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

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

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

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

f = A("f")
h = B("h")
g = C("g")
n = D("n")
b = E("b")
d = B("d")
l = C("l")

f.r = b
f.s = g
f.v = n
h.v = f
g.y = f
g.w = l
g.u = n
g.t = h
n.t = l
n.u = f
n.q = b
b.s = f
d.v = f
l.y = f
l.w = g
l.u = n
l.t = d
assert l.t.v.s.w.u.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.s: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

f = A("f")
h = B("h")
g = C("g")
n = D("n")
b = E("b")
d = B("d")
l = C("l")

f.r = b
f.s = g
f.v = n
h.v = f
g.y = f
g.w = l
g.u = n
g.t = h
n.t = l
n.u = f
n.q = b
b.s = f
d.v = f
l.y = f
l.w = g
l.u = n
l.t = d
assert l.t.v.s.w.u.q.s.txt == "f"