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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: D = None
        self.z: D = None
        self.txt = txt

b = A("b")
n = B("n")
e = C("e")
c = D("c")
l = E("l")
m = C("m")
k = A("k")

b.q = k
b.t = k
b.s = l
b.v = e
b.r = c
n.t = l
n.u = e
e.v = l
e.r = m
c.o = l
c.p = l
c.u = l
c.x = n
l.t = k
l.v = c
l.z = c
m.v = l
m.r = e
k.q = b
k.t = b
k.s = l
k.v = e
k.r = c
assert m.r.v.t.s.t.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: E = None
        self.v: C = None
        self.t: A = None
        self.r: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.v: D = None
        self.z: D = None
        self.txt = txt

b = A("b")
n = B("n")
e = C("e")
c = D("c")
l = E("l")
m = C("m")
k = A("k")

b.q = k
b.t = k
b.s = l
b.v = e
b.r = c
n.t = l
n.u = e
e.v = l
e.r = m
c.o = l
c.p = l
c.u = l
c.x = n
l.t = k
l.v = c
l.z = c
m.v = l
m.r = e
k.q = b
k.t = b
k.s = l
k.v = e
k.r = c
assert m.r.v.t.s.t.s.v.txt == "c"