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

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

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

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

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

n.y = i
i.u = n
h.p = i
e.p = h
assert i.u.y.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

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

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

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

n.y = i
i.u = n
h.p = i
e.p = h
assert i.u.y.u.y.txt == "i"