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

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

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

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

h = A("h")
j = B("j")
i = C("i")
d = D("d")
n = D("n")
e = B("e")

h.u = n
j.t = d
j.s = d
j.p = i
i.v = h
d.x = i
d.v = h
d.t = n
n.x = i
n.v = h
n.t = d
e.t = n
e.s = d
e.p = i
assert n.t.v.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

h = A("h")
j = B("j")
i = C("i")
d = D("d")
n = D("n")
e = B("e")

h.u = n
j.t = d
j.s = d
j.p = i
i.v = h
d.x = i
d.v = h
d.t = n
n.x = i
n.v = h
n.t = d
e.t = n
e.s = d
e.p = i
assert n.t.v.u.txt == "n"