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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: C = None
        self.t: A = None
        self.txt = txt

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

e = A("e")
c = B("c")
m = C("m")
f = D("f")
h = C("h")
b = D("b")
i = A("i")

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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: C = None
        self.t: A = None
        self.txt = txt

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

e = A("e")
c = B("c")
m = C("m")
f = D("f")
h = C("h")
b = D("b")
i = A("i")

e.y = b
e.z = m
c.u = f
c.w = m
c.v = i
c.r = i
m.w = e
m.z = h
m.t = i
f.r = b
f.y = b
f.u = c
f.z = h
h.w = i
h.t = i
h.z = m
b.r = f
b.y = f
b.u = c
b.z = m
i.y = b
i.z = h
assert h.w.y.u.u.z.t.y.txt == "b"