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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: A = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.w: E = None
        self.r: D = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: B = None
        self.v: B = None
        self.s: B = None
        self.o: C = None
        self.txt = txt

d = A("d")
c = B("c")
a = C("a")
n = D("n")
g = E("g")
b = D("b")
h = A("h")

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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.t: A = None
        self.s: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: B = None
        self.w: E = None
        self.r: D = None
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.u: B = None
        self.v: B = None
        self.s: B = None
        self.o: C = None
        self.txt = txt

d = A("d")
c = B("c")
a = C("a")
n = D("n")
g = E("g")
b = D("b")
h = A("h")

d.w = a
d.t = a
d.r = h
c.w = d
c.t = d
c.s = a
a.y = h
a.q = h
a.u = c
n.q = a
n.z = c
n.w = g
n.r = b
n.o = d
g.x = b
g.u = c
g.v = c
g.s = c
g.o = a
b.q = a
b.z = c
b.w = g
b.r = n
b.o = d
h.w = a
h.t = a
h.r = d
assert h.t.u.s.u.t.txt == "d"