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

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

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

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

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

g = A("g")
d = B("d")
b = C("b")
j = D("j")
l = E("l")
k = E("k")
n = C("n")
h = C("h")
a = B("a")

g.q = n
g.t = h
d.r = b
d.v = g
d.t = j
b.q = d
b.v = j
b.r = g
j.u = k
l.s = d
l.v = n
l.p = h
k.s = a
k.v = h
k.p = n
n.q = d
n.v = j
n.r = g
h.q = a
h.v = j
h.r = g
a.r = h
a.v = g
a.t = j
assert b.r.q.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: C = None
        self.txt = txt

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

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

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

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

g = A("g")
d = B("d")
b = C("b")
j = D("j")
l = E("l")
k = E("k")
n = C("n")
h = C("h")
a = B("a")

g.q = n
g.t = h
d.r = b
d.v = g
d.t = j
b.q = d
b.v = j
b.r = g
j.u = k
l.s = d
l.v = n
l.p = h
k.s = a
k.v = h
k.p = n
n.q = d
n.v = j
n.r = g
h.q = a
h.v = j
h.r = g
a.r = h
a.v = g
a.t = j
assert b.r.q.v.u.txt == "k"