class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.y: C = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

m.t = h
m.o = h
m.y = b
m.x = i
h.u = f
h.x = f
b.x = f
c.x = m
c.r = j
c.y = h
c.z = h
f.o = i
j.x = f
i.t = h
i.o = h
i.y = j
i.x = m
assert i.y.x.o.o.u.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.o: B = None
        self.y: C = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

m.t = h
m.o = h
m.y = b
m.x = i
h.u = f
h.x = f
b.x = f
c.x = m
c.r = j
c.y = h
c.z = h
f.o = i
j.x = f
i.t = h
i.o = h
i.y = j
i.x = m
assert i.y.x.o.o.u.o.y.txt == "j"