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

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

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

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

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

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

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

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

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

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

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

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

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