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

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

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

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

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

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

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

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

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

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

h.x = i
h.w = i
h.r = c
i.t = h
i.q = h
i.s = b
i.u = c
c.v = h
c.o = i
c.y = b
b.r = i
assert c.o.s.r.txt == "i"