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

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

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

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

i = A("i")
j = B("j")
e = C("e")
c = D("c")

i.t = e
i.v = e
i.x = c
i.y = c
j.y = i
j.x = c
e.s = j
e.w = c
e.p = c
c.v = e
c.t = e
c.s = j
c.r = j
assert j.y.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: C = None
        self.x: D = None
        self.y: D = None
        self.txt = txt

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

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

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

i = A("i")
j = B("j")
e = C("e")
c = D("c")

i.t = e
i.v = e
i.x = c
i.y = c
j.y = i
j.x = c
e.s = j
e.w = c
e.p = c
c.v = e
c.t = e
c.s = j
c.r = j
assert j.y.t.p.txt == "c"