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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: B = None
        self.w: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: B = None
        self.w: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

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