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

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

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

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

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

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

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

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

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

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

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

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

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