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

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

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

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

j = A("j")
b = B("b")
l = C("l")
g = D("g")

j.w = l
j.v = l
j.p = l
b.x = g
b.p = j
b.q = j
b.y = l
l.q = g
l.y = j
g.p = l
g.v = l
assert g.p.y.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: C = None
        self.p: C = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
l = C("l")
g = D("g")

j.w = l
j.v = l
j.p = l
b.x = g
b.p = j
b.q = j
b.y = l
l.q = g
l.y = j
g.p = l
g.v = l
assert g.p.y.p.y.txt == "j"