class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: B = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
m = C("m")
h = D("h")
j = D("j")

i.r = m
i.s = b
b.q = m
b.t = m
b.u = h
m.v = i
m.w = i
m.y = i
m.u = h
h.v = b
h.q = b
h.t = i
j.v = b
j.q = b
j.t = i
assert i.s.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.s: B = None
        self.txt = txt

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

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

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

i = A("i")
b = B("b")
m = C("m")
h = D("h")
j = D("j")

i.r = m
i.s = b
b.q = m
b.t = m
b.u = h
m.v = i
m.w = i
m.y = i
m.u = h
h.v = b
h.q = b
h.t = i
j.v = b
j.q = b
j.t = i
assert i.s.u.t.txt == "i"