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

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

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

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

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

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

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

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

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

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

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

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

b.q = e
b.u = m
e.x = k
e.v = k
e.r = b
h.o = e
m.v = h
m.q = h
m.u = e
m.o = e
m.t = b
j.t = b
j.u = b
j.p = b
k.o = i
i.x = k
i.v = h
i.r = b
a.x = h
a.v = c
a.r = b
c.o = a
assert b.q.r.q.v.o.x.txt == "k"