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

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: E = None
        self.p: E = None
        self.x: A = None
        self.w: B = None
        self.txt = txt

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

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

g.s = d
g.x = n
d.t = m
d.y = m
d.x = k
d.v = k
k.p = d
m.u = j
m.t = i
m.p = i
m.x = g
m.w = d
i.r = k
i.v = m
i.o = n
i.p = j
j.p = d
n.t = m
n.y = m
n.x = j
n.v = k
assert m.u.p.x.p.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: C = None
        self.t: E = None
        self.p: E = None
        self.x: A = None
        self.w: B = None
        self.txt = txt

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

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

g.s = d
g.x = n
d.t = m
d.y = m
d.x = k
d.v = k
k.p = d
m.u = j
m.t = i
m.p = i
m.x = g
m.w = d
i.r = k
i.v = m
i.o = n
i.p = j
j.p = d
n.t = m
n.y = m
n.x = j
n.v = k
assert m.u.p.x.p.t.t.txt == "i"