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

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

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

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

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

b = A("b")
g = B("g")
i = C("i")
f = D("f")
l = E("l")
a = A("a")
n = C("n")

b.r = g
b.y = f
b.v = f
b.u = f
b.x = i
g.t = f
g.q = l
i.u = a
f.u = b
f.s = i
f.v = n
l.v = n
a.r = g
a.y = f
a.v = f
a.u = f
a.x = n
n.u = a
assert g.q.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.y: D = None
        self.x: C = None
        self.v: D = None
        self.u: D = None
        self.txt = txt

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

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

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

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

b = A("b")
g = B("g")
i = C("i")
f = D("f")
l = E("l")
a = A("a")
n = C("n")

b.r = g
b.y = f
b.v = f
b.u = f
b.x = i
g.t = f
g.q = l
i.u = a
f.u = b
f.s = i
f.v = n
l.v = n
a.r = g
a.y = f
a.v = f
a.u = f
a.x = n
n.u = a
assert g.q.v.u.txt == "a"