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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: B = None
        self.v: E = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: B = None
        self.v: E = None
        self.u: A = None
        self.p: E = None
        self.txt = txt

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

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

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