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

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

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

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

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

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

i.r = k
i.x = k
i.t = d
e.p = m
j.u = g
j.x = k
j.r = i
k.q = j
g.t = d
g.x = d
d.u = m
d.x = k
d.r = i
m.t = j
m.x = j
assert i.x.q.x.q.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

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

i.r = k
i.x = k
i.t = d
e.p = m
j.u = g
j.x = k
j.r = i
k.q = j
g.t = d
g.x = d
d.u = m
d.x = k
d.r = i
m.t = j
m.x = j
assert i.x.q.x.q.u.t.txt == "d"