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

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

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

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

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

n = A("n")
c = B("c")
k = C("k")
h = D("h")
i = E("i")
b = B("b")
a = A("a")
f = E("f")
g = E("g")

n.q = b
n.y = c
c.u = k
c.x = k
k.p = f
h.r = k
h.w = n
h.u = n
i.w = a
i.t = a
i.q = h
i.s = g
b.u = k
b.x = k
a.q = c
a.y = b
f.w = n
f.t = n
f.q = h
f.s = g
g.w = n
g.q = h
g.s = f
g.t = a
assert c.u.p.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: B = None
        self.txt = txt

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

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

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

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

n = A("n")
c = B("c")
k = C("k")
h = D("h")
i = E("i")
b = B("b")
a = A("a")
f = E("f")
g = E("g")

n.q = b
n.y = c
c.u = k
c.x = k
k.p = f
h.r = k
h.w = n
h.u = n
i.w = a
i.t = a
i.q = h
i.s = g
b.u = k
b.x = k
a.q = c
a.y = b
f.w = n
f.t = n
f.q = h
f.s = g
g.w = n
g.q = h
g.s = f
g.t = a
assert c.u.p.s.s.txt == "f"