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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: B = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.z: B = None
        self.txt = txt

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

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

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

g.y = f
g.w = f
g.q = e
h.r = m
h.q = c
h.y = f
h.x = g
e.r = f
e.z = h
a.u = g
d.x = f
d.u = f
d.p = f
d.t = a
c.r = f
c.z = h
j.r = m
j.q = c
j.y = f
j.x = g
m.u = g
f.x = d
f.u = d
f.p = d
f.t = a
assert a.u.y.t.u.w.x.txt == "d"