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

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

j = A("j")
c = B("c")
f = C("f")
d = D("d")
h = B("h")
i = C("i")

j.t = f
j.v = h
j.p = i
c.v = j
c.y = d
f.x = c
f.u = j
f.p = i
d.z = c
h.v = j
h.y = d
i.x = h
i.u = j
i.p = f
assert f.p.p.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: B = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: B = None
        self.txt = txt

j = A("j")
c = B("c")
f = C("f")
d = D("d")
h = B("h")
i = C("i")

j.t = f
j.v = h
j.p = i
c.v = j
c.y = d
f.x = c
f.u = j
f.p = i
d.z = c
h.v = j
h.y = d
i.x = h
i.u = j
i.p = f
assert f.p.p.x.txt == "c"