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

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

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

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

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

e.x = c
e.p = b
e.s = i
b.o = c
b.r = e
i.p = c
i.y = h
i.z = h
c.q = j
c.y = b
h.p = c
h.y = i
h.z = i
j.x = c
j.p = b
j.s = i
assert b.r.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: B = None
        self.s: C = None
        self.txt = txt

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

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

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

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

e.x = c
e.p = b
e.s = i
b.o = c
b.r = e
i.p = c
i.y = h
i.z = h
c.q = j
c.y = b
h.p = c
h.y = i
h.z = i
j.x = c
j.p = b
j.s = i
assert b.r.x.y.txt == "b"