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

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

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

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

i = A("i")
k = B("k")
h = C("h")
j = D("j")

i.x = k
i.u = k
i.p = k
i.v = j
k.r = j
h.u = j
h.y = j
j.u = h
j.y = h
j.t = k
j.r = k
assert i.v.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.u: B = None
        self.p: B = None
        self.v: D = None
        self.txt = txt

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

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

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

i = A("i")
k = B("k")
h = C("h")
j = D("j")

i.x = k
i.u = k
i.p = k
i.v = j
k.r = j
h.u = j
h.y = j
j.u = h
j.y = h
j.t = k
j.r = k
assert i.v.u.y.txt == "j"