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

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: B = None
        self.o: D = None
        self.q: A = None
        self.v: A = None
        self.txt = txt

f = A("f")
j = B("j")
g = C("g")
d = D("d")
i = E("i")
k = E("k")

f.v = d
f.o = j
j.u = g
g.s = d
g.t = d
d.q = g
d.r = g
d.t = f
i.p = f
i.q = f
i.v = f
i.t = j
i.o = d
k.p = f
k.q = f
k.v = f
k.t = j
k.o = d
assert j.u.s.t.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.o: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: C = None
        self.r: C = None
        self.t: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.t: B = None
        self.o: D = None
        self.q: A = None
        self.v: A = None
        self.txt = txt

f = A("f")
j = B("j")
g = C("g")
d = D("d")
i = E("i")
k = E("k")

f.v = d
f.o = j
j.u = g
g.s = d
g.t = d
d.q = g
d.r = g
d.t = f
i.p = f
i.q = f
i.v = f
i.t = j
i.o = d
k.p = f
k.q = f
k.v = f
k.t = j
k.o = d
assert j.u.s.t.v.t.v.txt == "d"