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

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

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

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

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

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

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

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

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

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

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

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

b.s = m
b.r = k
b.q = d
b.t = d
b.u = l
g.w = n
g.p = m
m.x = b
m.q = b
k.r = e
c.s = m
l.s = m
n.s = m
d.s = m
d.r = k
d.q = e
d.t = e
d.u = c
e.s = m
e.r = k
e.q = d
e.t = d
e.u = n
h.r = d
assert b.r.r.r.txt == "k"