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

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

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

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

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

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

f.u = g
g.y = m
g.z = m
g.x = f
g.q = e
g.u = c
b.p = l
b.q = g
b.t = i
b.w = h
b.z = h
i.u = h
i.q = c
h.w = i
l.u = h
l.q = c
m.y = g
m.z = g
m.x = e
m.q = e
m.u = c
e.u = g
a.u = m
c.p = i
c.t = i
c.q = m
c.w = h
c.z = h
assert g.y.z.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

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

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

f.u = g
g.y = m
g.z = m
g.x = f
g.q = e
g.u = c
b.p = l
b.q = g
b.t = i
b.w = h
b.z = h
i.u = h
i.q = c
h.w = i
l.u = h
l.q = c
m.y = g
m.z = g
m.x = e
m.q = e
m.u = c
e.u = g
a.u = m
c.p = i
c.t = i
c.q = m
c.w = h
c.z = h
assert g.y.z.x.u.txt == "g"