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

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

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

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

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

b = A("b")
k = B("k")
i = C("i")
h = D("h")
m = E("m")
g = B("g")
n = B("n")
d = A("d")

b.t = i
b.r = m
b.q = m
b.s = g
k.o = i
i.v = m
h.u = i
h.t = i
h.x = d
h.r = b
m.u = i
g.o = i
n.o = i
d.t = i
d.r = m
d.q = m
d.s = n
assert g.o.v.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: E = None
        self.s: B = None
        self.q: E = None
        self.txt = txt

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

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

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

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

b = A("b")
k = B("k")
i = C("i")
h = D("h")
m = E("m")
g = B("g")
n = B("n")
d = A("d")

b.t = i
b.r = m
b.q = m
b.s = g
k.o = i
i.v = m
h.u = i
h.t = i
h.x = d
h.r = b
m.u = i
g.o = i
n.o = i
d.t = i
d.r = m
d.q = m
d.s = n
assert g.o.v.u.v.txt == "m"