class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: A = None
        self.s: B = 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.t: E = None
        self.p: B = None
        self.o: E = None
        self.u: A = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
d = C("d")
c = D("c")
m = E("m")
j = A("j")

i.q = c
i.v = j
i.s = k
k.x = c
d.t = m
d.o = m
d.p = k
d.u = j
c.v = d
m.t = k
j.q = c
j.v = i
j.s = k
assert d.p.x.v.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.v: A = None
        self.s: B = 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.t: E = None
        self.p: B = None
        self.o: E = None
        self.u: A = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
d = C("d")
c = D("c")
m = E("m")
j = A("j")

i.q = c
i.v = j
i.s = k
k.x = c
d.t = m
d.o = m
d.p = k
d.u = j
c.v = d
m.t = k
j.q = c
j.v = i
j.s = k
assert d.p.x.v.p.txt == "k"