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

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

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

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

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

c = A("c")
a = B("a")
m = C("m")
f = D("f")
k = E("k")
d = B("d")

c.t = f
a.y = c
a.x = m
m.u = a
f.y = d
f.p = k
f.o = c
k.v = f
k.y = a
k.s = c
d.y = c
d.x = m
assert f.y.y.t.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

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

c = A("c")
a = B("a")
m = C("m")
f = D("f")
k = E("k")
d = B("d")

c.t = f
a.y = c
a.x = m
m.u = a
f.y = d
f.p = k
f.o = c
k.v = f
k.y = a
k.s = c
d.y = c
d.x = m
assert f.y.y.t.p.v.txt == "f"