class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

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

g = A("g")
d = B("d")
a = C("a")
k = D("k")
c = E("c")
n = C("n")
l = B("l")
m = A("m")

g.w = m
d.x = l
a.t = c
a.v = d
a.q = l
a.z = k
a.u = n
k.p = c
k.v = a
c.q = k
c.y = g
n.t = c
n.v = l
n.q = d
n.z = k
n.u = a
l.x = d
m.w = g
assert c.q.p.q.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

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

g = A("g")
d = B("d")
a = C("a")
k = D("k")
c = E("c")
n = C("n")
l = B("l")
m = A("m")

g.w = m
d.x = l
a.t = c
a.v = d
a.q = l
a.z = k
a.u = n
k.p = c
k.v = a
c.q = k
c.y = g
n.t = c
n.v = l
n.q = d
n.z = k
n.u = a
l.x = d
m.w = g
assert c.q.p.q.p.q.txt == "k"