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

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

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

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

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

m = A("m")
a = B("a")
f = C("f")
b = D("b")
e = E("e")
d = C("d")
j = D("j")

m.t = e
a.v = m
f.s = d
f.p = a
b.t = e
b.r = e
b.y = j
e.v = m
e.t = b
d.s = f
d.p = a
j.t = e
j.r = e
j.y = b
assert e.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

m = A("m")
a = B("a")
f = C("f")
b = D("b")
e = E("e")
d = C("d")
j = D("j")

m.t = e
a.v = m
f.s = d
f.p = a
b.t = e
b.r = e
b.y = j
e.v = m
e.t = b
d.s = f
d.p = a
j.t = e
j.r = e
j.y = b
assert e.v.t.v.txt == "m"