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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: D = None
        self.y: A = None
        self.txt = txt

k = A("k")
b = B("b")
h = C("h")
m = D("m")
g = E("g")
a = A("a")
f = E("f")
j = E("j")

k.t = m
k.w = m
k.r = m
k.y = b
b.x = f
h.s = j
h.v = g
h.u = f
m.r = h
g.z = m
g.v = m
g.y = a
a.t = m
a.w = m
a.r = m
a.y = b
f.z = m
f.v = m
f.y = a
j.z = m
j.v = m
j.y = k
assert a.r.r.v.y.y.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: B = None
        self.w: D = None
        self.r: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.v: D = None
        self.y: A = None
        self.txt = txt

k = A("k")
b = B("b")
h = C("h")
m = D("m")
g = E("g")
a = A("a")
f = E("f")
j = E("j")

k.t = m
k.w = m
k.r = m
k.y = b
b.x = f
h.s = j
h.v = g
h.u = f
m.r = h
g.z = m
g.v = m
g.y = a
a.t = m
a.w = m
a.r = m
a.y = b
f.z = m
f.v = m
f.y = a
j.z = m
j.v = m
j.y = k
assert a.r.r.v.y.y.x.v.txt == "m"