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

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

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

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

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

i.t = g
i.q = g
l.v = g
l.p = b
l.u = i
g.p = l
g.u = b
b.u = l
b.y = i
b.s = i
assert i.q.u.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.q: C = None
        self.txt = txt

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

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

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

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

i.t = g
i.q = g
l.v = g
l.p = b
l.u = i
g.p = l
g.u = b
b.u = l
b.y = i
b.s = i
assert i.q.u.y.txt == "i"