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

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

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

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

i = A("i")
l = B("l")
c = C("c")
h = D("h")
b = C("b")

i.w = h
i.x = h
i.o = b
l.p = c
c.y = l
c.w = l
c.v = h
c.t = i
h.w = l
b.y = l
b.w = l
b.v = h
b.t = i
assert l.p.y.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: D = None
        self.o: C = None
        self.x: D = None
        self.txt = txt

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

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

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

i = A("i")
l = B("l")
c = C("c")
h = D("h")
b = C("b")

i.w = h
i.x = h
i.o = b
l.p = c
c.y = l
c.w = l
c.v = h
c.t = i
h.w = l
b.y = l
b.w = l
b.v = h
b.t = i
assert l.p.y.p.y.txt == "l"