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

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: E = None
        self.p: B = None
        self.w: B = None
        self.u: D = None
        self.txt = txt

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

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

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

c.u = k
c.v = a
g.v = j
g.u = j
g.q = m
g.y = c
m.t = b
m.z = n
m.p = g
m.w = g
m.u = k
k.v = c
k.q = c
k.w = g
b.o = g
b.q = a
b.p = h
n.o = g
n.q = m
n.p = j
j.v = c
j.q = c
j.w = g
a.t = n
a.z = n
a.p = g
a.w = g
a.u = k
h.v = c
h.q = c
h.w = g
assert k.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: E = None
        self.p: B = None
        self.w: B = None
        self.u: D = None
        self.txt = txt

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

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

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

c.u = k
c.v = a
g.v = j
g.u = j
g.q = m
g.y = c
m.t = b
m.z = n
m.p = g
m.w = g
m.u = k
k.v = c
k.q = c
k.w = g
b.o = g
b.q = a
b.p = h
n.o = g
n.q = m
n.p = j
j.v = c
j.q = c
j.w = g
a.t = n
a.z = n
a.p = g
a.w = g
a.u = k
h.v = c
h.q = c
h.w = g
assert k.q.u.q.txt == "c"