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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.t: D = None
        self.u: D = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
k = C("k")
d = D("d")
g = E("g")
h = B("h")
c = D("c")
m = D("m")
i = E("i")

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

class B:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: B = None
        self.t: D = None
        self.u: D = None
        self.txt = txt

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

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

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

f = A("f")
l = B("l")
k = C("k")
d = D("d")
g = E("g")
h = B("h")
c = D("c")
m = D("m")
i = E("i")

f.s = k
f.w = m
f.y = g
f.q = c
l.y = h
l.s = h
l.t = c
l.u = c
k.y = h
k.w = m
k.t = i
k.u = l
d.v = m
d.w = m
d.r = f
d.x = g
g.y = i
g.p = f
h.y = l
h.s = l
h.t = d
h.u = c
c.v = d
c.w = d
c.r = f
c.x = g
m.v = c
m.w = c
m.r = f
m.x = g
i.y = g
i.p = f
assert l.s.t.r.w.txt == "m"