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

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

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

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

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

f = A("f")
c = B("c")
k = C("k")
j = D("j")
d = E("d")
l = A("l")

f.y = k
c.t = k
c.v = k
c.o = k
c.r = k
c.y = j
k.v = d
k.y = c
j.x = d
d.p = k
d.t = k
d.v = l
l.y = k
assert j.x.p.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

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

f = A("f")
c = B("c")
k = C("k")
j = D("j")
d = E("d")
l = A("l")

f.y = k
c.t = k
c.v = k
c.o = k
c.r = k
c.y = j
k.v = d
k.y = c
j.x = d
d.p = k
d.t = k
d.v = l
l.y = k
assert j.x.p.v.txt == "d"