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

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

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

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

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

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

c.u = a
c.q = a
c.r = j
a.p = m
a.v = g
a.x = b
g.x = d
g.q = d
g.v = c
j.p = c
j.t = c
j.v = g
j.x = a
m.r = a
m.y = g
m.s = h
m.v = k
b.p = c
b.t = c
b.v = k
b.x = a
k.x = c
k.q = c
k.v = c
h.r = a
h.y = k
h.s = m
h.v = g
d.u = a
d.q = a
d.r = j
assert b.x.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.r: D = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

c.u = a
c.q = a
c.r = j
a.p = m
a.v = g
a.x = b
g.x = d
g.q = d
g.v = c
j.p = c
j.t = c
j.v = g
j.x = a
m.r = a
m.y = g
m.s = h
m.v = k
b.p = c
b.t = c
b.v = k
b.x = a
k.x = c
k.q = c
k.v = c
h.r = a
h.y = k
h.s = m
h.v = g
d.u = a
d.q = a
d.r = j
assert b.x.x.v.txt == "k"