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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

b.y = d
b.z = d
b.x = j
b.u = j
b.o = f
m.x = f
d.r = m
d.w = b
d.v = j
f.o = m
j.z = m
j.r = m
j.x = i
j.t = b
j.q = d
i.z = m
i.r = m
i.x = j
i.t = b
i.q = d
assert j.t.u.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.z: C = None
        self.x: E = None
        self.u: E = None
        self.o: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.txt = txt

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

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

b.y = d
b.z = d
b.x = j
b.u = j
b.o = f
m.x = f
d.r = m
d.w = b
d.v = j
f.o = m
j.z = m
j.r = m
j.x = i
j.t = b
j.q = d
i.z = m
i.r = m
i.x = j
i.t = b
i.q = d
assert j.t.u.q.v.txt == "j"