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

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

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

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

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

a = A("a")
b = B("b")
c = C("c")
i = D("i")
j = E("j")
d = C("d")

a.o = b
a.v = d
a.w = d
a.r = i
b.t = a
c.y = i
c.x = d
i.r = c
i.s = j
i.v = j
i.u = a
j.q = b
j.t = b
d.y = i
d.x = c
assert d.x.x.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: C = None
        self.r: D = None
        self.w: C = None
        self.txt = txt

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

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

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

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

a = A("a")
b = B("b")
c = C("c")
i = D("i")
j = E("j")
d = C("d")

a.o = b
a.v = d
a.w = d
a.r = i
b.t = a
c.y = i
c.x = d
i.r = c
i.s = j
i.v = j
i.u = a
j.q = b
j.t = b
d.y = i
d.x = c
assert d.x.x.y.s.txt == "j"